From ad237b6669c62534341fef522f469beaf7484b00 Mon Sep 17 00:00:00 2001 From: Sean Wong Date: Tue, 31 Dec 2019 19:14:41 +0800 Subject: [PATCH] master: masking input with empty rune to not increment the cursor position to prevent the input length being revealed --- cursor.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cursor.go b/cursor.go index 959c800..be2a06f 100644 --- a/cursor.go +++ b/cursor.go @@ -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