From 07e8e016662b863d464b80aa4ed750e561338a09 Mon Sep 17 00:00:00 2001 From: hashinclude Date: Thu, 13 Feb 2025 03:59:12 -0800 Subject: [PATCH] Make "up-arrow" handling consistent with or without a substring search Currently up arrow behaves like "up-history" in substring search mode, and "up-line-or-history" when there's no substring. This causes inconsistency with multiline commands. Fish behaves in the same way for both cases. --- zsh-history-substring-search.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zsh-history-substring-search.zsh b/zsh-history-substring-search.zsh index 2137b79..7f8847b 100644 --- a/zsh-history-substring-search.zsh +++ b/zsh-history-substring-search.zsh @@ -499,6 +499,11 @@ _history-substring-search-up-history() { BUFFER= # going up from somewhere below the top of history + # the cursor is at the end of a multiline prompt, go up in history. + elif [[ $CURSOR -eq $#BUFFER ]] then + zle up-history + + # Otherwise, keep the default behavior of up arrow. else zle up-line-or-history fi