Fix drawing InputField cursor outside of the field

This commit is contained in:
Trevor Slocum 2021-07-08 17:35:19 -07:00
parent a989031127
commit 78d52f46d0
2 changed files with 2 additions and 1 deletions

View File

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

View File

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