dex
dex copied to clipboard
Add select command option -k to keep existing selections
The current behavior of the select
command is to call unselect
when a selection already exists. This can be problematic in commands that convert selections to line selections. For example, the following script is supposed to prepend a //
to each line in a selection, so it tries to convert regular selection into a line selection becaue otherwise the read
command may not read the last line.
alias comment-lines \
"select -l; filter $SHELL -c 'while read -r line; do printf \"//%s\n\" \"$line\"; done'
This PR adds an extra option to the select
command, -k
, that keeps existing selections.
Is there a use case that can't be reasonably solved by just doing your selections with select -l
in the first place?
I can't reproduce any problems with this (assuming the line is closed with a double-quote). How can I reproduce it? Do you have a 'recipe' that reliably exhibits a problem??