From bffc9515a8956859d492b67fa33b6a82deeef7bf Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 23 Mar 2024 14:00:54 +0100 Subject: [PATCH] Fix bracketed paste regression from input event queue changes We have bind --preset -M $mode --sets-mode paste \e\[200~ __fish_start_bracketed_paste Commit c3cd68dda (Process shell commands from bindings like regular char events, 2024-03-02) made it so __fish_start_bracketed_paste is no longer executed before the bind mode is updated. This is a long-awaited fix but it broke __fish_start_bracketed_paste's assumption that $fish_bind_mode is the mode before we entered paste mode. This means we never exit paste mode. Work around that. I forgot about this issue because I already replaced our bracketed paste handling on my fork. --- share/functions/__fish_shared_key_bindings.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/functions/__fish_shared_key_bindings.fish b/share/functions/__fish_shared_key_bindings.fish index 69a1fed96..7b931e51d 100644 --- a/share/functions/__fish_shared_key_bindings.fish +++ b/share/functions/__fish_shared_key_bindings.fish @@ -144,7 +144,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod # Bind the starting sequence in every bind mode, even user-defined ones. # Exclude paste mode or there'll be an additional binding after switching between emacs and vi for mode in (bind --list-modes | string match -v paste) - bind --preset -M $mode -m paste \e\[200~ __fish_start_bracketed_paste + bind --preset -M $mode -m paste \e\[200~ "__fish_start_bracketed_paste $mode" end # This sequence ends paste-mode and returns to the previous mode we have saved before. bind --preset -M paste \e\[201~ __fish_stop_bracketed_paste @@ -214,7 +214,7 @@ end function __fish_start_bracketed_paste # Save the last bind mode so we can restore it. - set -g __fish_last_bind_mode $fish_bind_mode + set -g __fish_last_bind_mode $argv[1] # If the token is currently single-quoted, # we escape single-quotes (and backslashes). string match -q 'single*' (__fish_tokenizer_state -- (commandline -ct | string collect))