New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
history pager: delete selected history entry with Shift-Delete #9515
Conversation
This seems like a good idea. My question is if we could make the bind function more general and have it delete the current commandline if the pager isn't open?
I'm kind of wary of adding something permanent like this to a very simple key press that you might just use to edit. So I think I'd prefer shift-delete for now. |
shift-delete matches the behavior of native Windows autocomplete inputs w/ history enabled, which was later adopted by Chrom(e|ium) and, I think, Firefox. I'm not comfortable with a plain delete binding, either. |
sounds good, let's stick to Shift+Delete
Yeah we should make it work at least during an up-arrow search (where Shift+Delete shall switch to the next older match). There's a bug left, deletion does not work for space-prefixed commands. No big deal but would be nice to fix. |
Are you happy to merge this for now without that fix? |
…binding The tentative binding for the upcoming "history-pager-delete" is bind -k sdc history-pager-delete or backward-delete-char When Shift+Delete is pressed while the history pager is active, "history-pager-delete" succeeds. In this case, the "or" needs to kick the "backward-delete-char" out of the input queue. After doing so, it continues reading, but interprets the input as single-char binding. This breaks when the next key emits a multi-char sequence, like the arrow keys. Fix this by reading a full sequence, which means we need to run "read_char()" instead of "read_ch()" (confusing, right?). I'm still working on writing a test. Somehow this only reproduces in the history pager where Shift+Delete followed by down arrow emits "[B" (since we swallowed the leading escape char). Confusingly, it doesn't do that in the commandline or the completion search field.
No functional change.
37e38b7
to
254f201
Compare
After accidentally running a command that includes a pasted password, I want to delete command from history. Today we need to recall or type (part of) that command and type "history delete". Let's maybe add a shortcut to do this from the history pager. The current shortcut is Shift+Delete. I don't think that's very discoverable, maybe we should use Delete instead (but only if the cursor is at the end of the commandline, otherwise delete a char). Closes fish-shell#9454
254f201
to
19476c7
Compare
yeah; actually I can't reproduce the problem with space-prefixed ("ephemeral") commands anymore. Looks like we only ever keep one of them in memory, for simplicity of implementation. |
After #2110 has been resolved I was looking into this, but I'm not sure if i get this right:
Anything I'm missing @krobelus ?
|
No. It should delete the history entry you are selecting in the history pager, the thing you start with ctrl-r. We've decided not to do it in the commandline for now. |
I still think we should try to make it work in the commandline but it's not clear to me what the UI should look like. |
Popular operating systems support shift-delete to delete the selected item in an autocompletion widgets. We already support this in the history pager. Let's do the same for up-arrow history search. Related discussion: #9515
Popular operating systems support shift-delete to delete the selected item in an autocompletion widgets. We already support this in the history pager. Let's do the same for up-arrow history search. Related discussion: fish-shell#9515
After accidentally running a command that includes a pasted password, I want
to delete that command from history. Today we need to recall or type (part of)
that command and type "history delete". Let's maybe add a shortcut to do
this from the history pager.
The current shortcut is Shift+Delete. I don't think that's very discoverable,
maybe we should use Delete instead (but only if the cursor is at the end of
the commandline, otherwise delete a char).
Closes #9454