Added tabs. Also added TextArea to main documentation.

This commit is contained in:
Oliver 2022-08-13 17:03:57 +02:00
parent ad62b2aa7c
commit 980ae61d2a
1 changed files with 8 additions and 0 deletions

View File

@ -1420,6 +1420,14 @@ func (t *TextArea) InputHandler() func(event *tcell.EventKey, setFocus func(p Pr
t.cursor.row = -1 t.cursor.row = -1
t.truncateLines(row - 1) t.truncateLines(row - 1)
t.clampToCursor(row) t.clampToCursor(row)
t.selectionStart = t.cursor
case tcell.KeyTab: // Insert TabSize spaces.
from, to, row := t.getSelection()
t.cursor.pos = t.replace(from, to, strings.Repeat(" ", TabSize))
t.cursor.row = -1
t.truncateLines(row - 1)
t.clampToCursor(row)
t.selectionStart = t.cursor
case tcell.KeyRune: case tcell.KeyRune:
if event.Modifiers()&tcell.ModAlt > 0 { if event.Modifiers()&tcell.ModAlt > 0 {
// We accept some Alt- key combinations. // We accept some Alt- key combinations.