Skip to content

Commit

Permalink
[main-] treat numeric subsheet str as idx, not name
Browse files Browse the repository at this point in the history
  • Loading branch information
midichef committed Jun 18, 2024
1 parent da52ac3 commit 1d3f20d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions visidata/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,18 @@ def moveToPos(vd, sources, startsheets, startcol, startrow):
vd.clearCaches()
# descend the tree of subsheets
for subsheet in startsheets[1:]:
rowidx = vs.getRowIndexFromStr(vd.options.rowkey_prefix + subsheet)
if rowidx is None:
vd.warning(f'{vs.name} has no subsheet "{subsheet}"')
if subsheet and subsheet.isdigit():
rowidx = int(subsheet)
else:
rowidx = vs.getRowIndexFromStr(vd.options.rowkey_prefix + subsheet)
if rowidx is None:
vd.warning(f'{vs.name} has no subsheet "{subsheet}"')
return
try:
vs = vs.rows[rowidx]
except IndexError:
vd.warning(f'{vs.name} has no subsheet "{rowidx}"')
return
vs = vs.rows[rowidx]
if not isinstance(vs, BaseSheet):
vd.warning(f'row {subsheet} for subsheet is not a sheet')
return
Expand Down

0 comments on commit 1d3f20d

Please sign in to comment.