From 78d52f46d0eba5a7d4c9d341bd09b8636bf02bb2 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Thu, 8 Jul 2021 17:35:19 -0700 Subject: [PATCH] Fix drawing InputField cursor outside of the field --- CHANGELOG | 1 + inputfield.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index a7c6674..936fd97 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ v1.5.6 (WIP) - Add DropDown.SetDropDownOpenSymbolRune - Fix TextView always visible scroll bar not appearing when empty - Fix passing mouse events to Grid items (events are now only passed to the item under the mouse) +- Fix drawing InputField cursor outside of the field - Draw additional accents when rendering a list divider - Update Application.Draw and Application.QueueUpdateDraw to accept one or more primitives to draw instead of the whole screen diff --git a/inputfield.go b/inputfield.go index ccf35a7..de82c9f 100644 --- a/inputfield.go +++ b/inputfield.go @@ -613,7 +613,7 @@ func (i *InputField) Draw(screen tcell.Screen) { text = bytes.Repeat([]byte(string(i.maskCharacter)), utf8.RuneCount(i.text)) } var drawnText []byte - if fieldWidth >= runewidth.StringWidth(string(text)) { + if fieldWidth > runewidth.StringWidth(string(text)) { // We have enough space for the full text. drawnText = EscapeBytes(text) Print(screen, drawnText, x, y, fieldWidth, AlignLeft, fieldTextColor)