Skip to content

Commit

Permalink
master: masking input with empty rune to not increment the cursor pos…
Browse files Browse the repository at this point in the history
…ition to prevent the input length being revealed
  • Loading branch information
wotzhs committed Dec 31, 2019
1 parent 8fa33db commit ad237b6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ func (c *Cursor) Format() string {

// FormatMask replaces all input runes with the mask rune.
func (c *Cursor) FormatMask(mask rune) string {
if mask == ' ' {
return format([]rune{}, c)
}

r := make([]rune, len(c.input))
for i := range r {
r[i] = mask
Expand Down

0 comments on commit ad237b6

Please sign in to comment.