mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 05:43:11 +00:00
Make bracketed paste add only one undo entry
Bracketed paste adds one undo entry unless the pasted text contains a ' or \. This is because the "paste" bind-mode has bindings for those keys, so they effectively start a new undo entry. Let's fix this by adding an explicit undo group (our first use of this feature!).
This commit is contained in:
parent
21f1eebd01
commit
29a3344226
1 changed files with 2 additions and 0 deletions
|
@ -216,10 +216,12 @@ function __fish_start_bracketed_paste
|
|||
# we escape single-quotes (and backslashes).
|
||||
string match -q 'single*' (__fish_tokenizer_state -- (commandline -ct | string collect))
|
||||
and set -g __fish_paste_quoted 1
|
||||
commandline -f begin-undo-group
|
||||
end
|
||||
|
||||
function __fish_stop_bracketed_paste
|
||||
# Restore the last bind mode.
|
||||
set fish_bind_mode $__fish_last_bind_mode
|
||||
set -e __fish_paste_quoted
|
||||
commandline -f end-undo-group
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue