Cursor fix for empty text areas / input fields. Fixes #915

pull/924/head
Oliver 6 months ago
parent 05d01944a1
commit 7c9e464bac

@ -1218,10 +1218,14 @@ func (t *TextArea) Draw(screen tcell.Screen) {
}
}()
// Placeholder.
if t.length == 0 && len(t.placeholder) > 0 {
t.drawPlaceholder(screen, x, y, width, height)
// No text / placeholder.
if t.length == 0 {
t.lastHeight, t.lastWidth = height, width
t.cursor.row, t.cursor.column, t.cursor.actualColumn, t.cursor.pos = 0, 0, 0, [3]int{1, 0, -1}
t.rowOffset, t.columnOffset = 0, 0
if len(t.placeholder) > 0 {
t.drawPlaceholder(screen, x, y, width, height)
}
return // We're done already.
}

Loading…
Cancel
Save