File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 11package promptui
22
3- import "fmt"
3+ import (
4+ "fmt"
5+ "strings"
6+ )
47
58// Pointer is A specific type that translates a given set of runes into a given
69// set of runes pointed at by the cursor.
@@ -144,6 +147,11 @@ func (c *Cursor) Get() string {
144147 return string (c .input )
145148}
146149
150+ // GetMask returns a mask string with length equal to the input
151+ func (c * Cursor ) GetMask (mask rune ) string {
152+ return strings .Repeat (string (mask ), len (c .input ))
153+ }
154+
147155// Replace replaces the previous input with whatever is specified, and moves the
148156// cursor to the end position
149157func (c * Cursor ) Replace (input string ) {
Original file line number Diff line number Diff line change @@ -218,9 +218,9 @@ func (p *Prompt) Run() (string, error) {
218218 return "" , err
219219 }
220220
221- echo := cur .Format ()
221+ echo := cur .Get ()
222222 if p .Mask != 0 {
223- echo = cur .FormatMask (p .Mask )
223+ echo = cur .GetMask (p .Mask )
224224 }
225225
226226 prompt := render (p .Templates .success , p .Label )
You can’t perform that action at this time.
0 commit comments