File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
package promptui
2
2
3
- import "fmt"
3
+ import (
4
+ "fmt"
5
+ "strings"
6
+ )
4
7
5
8
// Pointer is A specific type that translates a given set of runes into a given
6
9
// set of runes pointed at by the cursor.
@@ -144,6 +147,11 @@ func (c *Cursor) Get() string {
144
147
return string (c .input )
145
148
}
146
149
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
+
147
155
// Replace replaces the previous input with whatever is specified, and moves the
148
156
// cursor to the end position
149
157
func (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) {
218
218
return "" , err
219
219
}
220
220
221
- echo := cur .Format ()
221
+ echo := cur .Get ()
222
222
if p .Mask != 0 {
223
- echo = cur .FormatMask (p .Mask )
223
+ echo = cur .GetMask (p .Mask )
224
224
}
225
225
226
226
prompt := render (p .Templates .success , p .Label )
You can’t perform that action at this time.
0 commit comments