From 1d3f20d89e96974a45c84b94b0d9b618aba3f2be Mon Sep 17 00:00:00 2001 From: midichef <67946319+midichef@users.noreply.github.com> Date: Wed, 29 May 2024 01:22:03 -0700 Subject: [PATCH] [main-] treat numeric subsheet str as idx, not name --- visidata/main.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/visidata/main.py b/visidata/main.py index 5ead901b0..3285b611c 100755 --- a/visidata/main.py +++ b/visidata/main.py @@ -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