Fix drawing InputField cursor outside of the field

Trevor Slocum 2 years ago
parent a989031127
commit 78d52f46d0

@ -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

@ -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)