Fixed an infinite loop after clearing a selected cell. Fixes #944

This commit is contained in:
Oliver 2024-03-07 17:23:12 +01:00
parent 5605142ca6
commit e350bef1f9
1 changed files with 2 additions and 2 deletions

View File

@ -1422,7 +1422,6 @@ func (t *Table) InputHandler() func(event *tcell.EventKey, setFocus func(p Primi
down = func() {
if t.rowsSelectable {
row, column := t.selectedRow, t.selectedColumn
t.selectedRow++
if t.selectedRow >= rowCount {
if t.wrapVertically {
@ -1431,6 +1430,7 @@ func (t *Table) InputHandler() func(event *tcell.EventKey, setFocus func(p Primi
t.selectedRow = rowCount - 1
}
}
row, column := t.selectedRow, t.selectedColumn
finalRow, finalColumn := rowCount-1, lastColumn
if t.wrapVertically {
finalRow = row
@ -1447,7 +1447,6 @@ func (t *Table) InputHandler() func(event *tcell.EventKey, setFocus func(p Primi
up = func() {
if t.rowsSelectable {
row, column := t.selectedRow, t.selectedColumn
t.selectedRow--
if t.selectedRow < 0 {
if t.wrapVertically {
@ -1456,6 +1455,7 @@ func (t *Table) InputHandler() func(event *tcell.EventKey, setFocus func(p Primi
t.selectedRow = 0
}
}
row, column := t.selectedRow, t.selectedColumn
finalRow, finalColumn := 0, 0
if t.wrapVertically {
finalRow = row