Browse Source

Fix drawing InputField cursor outside of the field

textarea
Trevor Slocum 5 months ago
parent
commit
78d52f46d0
  1. 1
      CHANGELOG
  2. 2
      inputfield.go

1
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

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

Loading…
Cancel
Save