[main-] handle position args as +sheet:subsheet:col:row #2425
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Two bug fixes:
3ea655b - fixes setting column position in sheet
Currently the starting column cannot be set, only the row.
repro command:
vd sample_data/sample.tsv sample_data/StatusPR.csv +2:2
This occurs because the column position changes too early, before the sheet is loaded.
1aa2d98 - fixes setting column position in subsheet
A similar problem, changing position before the subsheet is loaded.
repro:
vd ~vdsrc/sample_data/employees.sqlite +:emp:5:2
And then some functionality changes:
d16743d - change arg parsing, from row:col to col:row
Strings of the form a:b are parsed as row:column. This commit changes it to column:row.
Previously, I discussed some pros and cons of this change.
This is technically a breaking change, but as I noted in that comment, the form
+a:b
has not worked since 2.9 so it's not likely that anyone is currently using that syntax. However, if they are using+:a:b
with the extra colon, this will indeed be a breaking change for them.repro:
vd ~vdsrc/sample_data/sample.tsv +:1:4
(note the
:
before the1
. It's needed (ondevelop
) to demonstrate the column-positioning bug, until the 2 commits above are applied.)0a8f6ee - handling args of form
+a:b
vs+:a:b
.Comments in the code suggest that '+col:row' should apply to only the last sheet on the list, vs. adding a colon, '+:col:row', which should apply to all sheets:
visidata/visidata/main.py
Line 90 in c01c2b5
(The suggestion comes from the phrase
Empty sheetstr in startsheets
. An emptysheetstr
happens only whenarg.split(':')
has more than 2 items andpos[:-2]
is''
, which happens whenarg
follows the pattern+:a:b
:visidata/visidata/main.py
Line 105 in c01c2b5
Currently the behavior is the reverse: +col:row applies to all sheets.
repro:
vd sample_data/sample.tsv sample_data/StatusPR.csv +:2:2
and look at the cursor position on each sheet.
This commit changes
+:a:b
to apply to all sheets, and+a:b
to apply only to the last sheet.da52ac3 - improve error for invalid sheets
Attempting to index a sheet that does not exist, as with:
repro:
vd sample_data/sample.tsv +10:0:0
gives a traceback with
IndexError: list index out of range
.This commit handles the error and shows a status message of
no sheet "10"
.a0d4913 - handling subsheet names that are integers
For consistency with sheets/rows/cols, this commit allows indexing subsheets with integers, like:
numeric-subsheet-names.vds.txt
repro:
vd -f vds numeric-subsheet-names.vds.txt +0:3:0:0
This is also a change that breaks current behavior, for a subsheet that happens to have a name that is an integer. Such a subsheet would become unable to opened by using its name, as with sheets
5
,6
,7
, and8
innumeric-subsheet-names.vds.txt
;+0:5:0:0
currently works, but after this commit only+0:0:0:0
would work.Thoughts? I'm not so worried about breaking changes, because I don't think the
vd +
feature is heavily used.Just to write out all the cases, here's what the args would mean after all these commits: