mirror of
https://github.com/rivo/tview.git
synced 2025-04-28 13:48:53 +08:00
Fixed an infinite loop after clearing a selected cell. Fixes #944
This commit is contained in:
parent
5605142ca6
commit
e350bef1f9
4
table.go
4
table.go
@ -1422,7 +1422,6 @@ func (t *Table) InputHandler() func(event *tcell.EventKey, setFocus func(p Primi
|
|||||||
|
|
||||||
down = func() {
|
down = func() {
|
||||||
if t.rowsSelectable {
|
if t.rowsSelectable {
|
||||||
row, column := t.selectedRow, t.selectedColumn
|
|
||||||
t.selectedRow++
|
t.selectedRow++
|
||||||
if t.selectedRow >= rowCount {
|
if t.selectedRow >= rowCount {
|
||||||
if t.wrapVertically {
|
if t.wrapVertically {
|
||||||
@ -1431,6 +1430,7 @@ func (t *Table) InputHandler() func(event *tcell.EventKey, setFocus func(p Primi
|
|||||||
t.selectedRow = rowCount - 1
|
t.selectedRow = rowCount - 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
row, column := t.selectedRow, t.selectedColumn
|
||||||
finalRow, finalColumn := rowCount-1, lastColumn
|
finalRow, finalColumn := rowCount-1, lastColumn
|
||||||
if t.wrapVertically {
|
if t.wrapVertically {
|
||||||
finalRow = row
|
finalRow = row
|
||||||
@ -1447,7 +1447,6 @@ func (t *Table) InputHandler() func(event *tcell.EventKey, setFocus func(p Primi
|
|||||||
|
|
||||||
up = func() {
|
up = func() {
|
||||||
if t.rowsSelectable {
|
if t.rowsSelectable {
|
||||||
row, column := t.selectedRow, t.selectedColumn
|
|
||||||
t.selectedRow--
|
t.selectedRow--
|
||||||
if t.selectedRow < 0 {
|
if t.selectedRow < 0 {
|
||||||
if t.wrapVertically {
|
if t.wrapVertically {
|
||||||
@ -1456,6 +1455,7 @@ func (t *Table) InputHandler() func(event *tcell.EventKey, setFocus func(p Primi
|
|||||||
t.selectedRow = 0
|
t.selectedRow = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
row, column := t.selectedRow, t.selectedColumn
|
||||||
finalRow, finalColumn := 0, 0
|
finalRow, finalColumn := 0, 0
|
||||||
if t.wrapVertically {
|
if t.wrapVertically {
|
||||||
finalRow = row
|
finalRow = row
|
||||||
|
Loading…
x
Reference in New Issue
Block a user