Skip to content

Commit

Permalink
[main-] fail moveToRow if row idx is past the sheet end
Browse files Browse the repository at this point in the history
Previously, moveToRow() would return True, and set the cursor
row index to the nonexistent row, with no visible errors.
For slow loading sheets, checkCursor() could then move
the cursor to an earlier row.
  • Loading branch information
midichef committed Nov 28, 2024
1 parent 69ccfb6 commit f65db0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion visidata/cmdlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def isLoggableSheet(sheet):
def moveToRow(vs, rowstr):
'Move cursor to row given by *rowstr*, which can be either the row number or keystr.'
rowidx = vs.getRowIndexFromStr(rowstr)
if rowidx is None:
if rowidx is None or rowidx >= vs.nRows:
return False

vs.cursorRowIndex = rowidx
Expand Down

0 comments on commit f65db0b

Please sign in to comment.