Skip to content

Commit

Permalink
Merge pull request #133 from Wotzhs/master
Browse files Browse the repository at this point in the history
masking input with empty rune to not increment the cursor position
  • Loading branch information
jbowes authored Sep 28, 2020
2 parents 5c05132 + ad237b6 commit 43f74af
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 @@ -124,6 +124,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 43f74af

Please sign in to comment.