Plugin Idea: Comma+Double Quote: Handle empty selection for dup-sheet #1647
Replies: 2 comments 1 reply
-
I like this idea! Originally dup-selected (and other bulk commands) would use "selected rows, or all rows if no rows are selected", but it became important for replayability that the commands didn't do something different with different inputs. So this command might have the same problem, but if it's only used interactively it sounds like it would be a boon. |
Beta Was this translation helpful? Give feedback.
-
I'm very happy you appreciate the suggestion. I missed this as part of the design of the VisiData commands that look at the selection. Sometimes as an interactive user I'll run a command when there is no selection and am surprised it is not doing anything. Agreed this command would have a similar problem depending on the input. Unexpected results from scripting should be expected. I think there are still commands within VisiData that have a similar issue where it can be difficult to have VisiData respond as expected. Like I can think of commands that rely on options for their behavior. I probably would use such a command mostly for interactive usage, but given how scripts are created it would be easy for interactive commands to be used in scripts. |
Beta Was this translation helpful? Give feedback.
-
Plugin idea for anyone that wants to try!
Create a variation of the double-quote
”
dup-selected
command, which is “open duplicate sheet with only selected rows”. To handle the case where there is no selection. My suggestion would be to do something similar to what you get when you combine comma followed by double-quote.The comma command
select-equal-cell
“selects rows matching the current cell in the current column”. Instead of setting the selection, it would just use the matching rows as the source for the duplicate sheet. And for this particular case, it would even give the new sheet a name based on the original cell value like is done when hitting Enter or “open-row” on a row in a FreqTableSheet. Thedup-selected
command by default names the new sheet with a trailing "_selectedref" suffix which I find provides only a little help when navigating the sheetsI like this for three reasons:
Actually the last case is how I came to this idea, I wanted more descriptive sheet names, and I like how it is done with Freq open-row.
Beta Was this translation helpful? Give feedback.
All reactions