From 29a3344226c2de75c5ea829296b84abbc82f1dd9 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 22 Jan 2023 20:59:31 +0100 Subject: [PATCH] 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!). --- share/functions/__fish_shared_key_bindings.fish | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/functions/__fish_shared_key_bindings.fish b/share/functions/__fish_shared_key_bindings.fish index f5b5e6e50..f99e3edbe 100644 --- a/share/functions/__fish_shared_key_bindings.fish +++ b/share/functions/__fish_shared_key_bindings.fish @@ -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