From 5911aca85f200cb7621b65ff61d79919fd21cfcb Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Tue, 14 Jul 2015 00:28:23 +0200 Subject: [PATCH] 35737: (tweaked c.f. Peter: 35759): use new undo limit for minibuffer and beep when limit is reached --- ChangeLog | 4 ++++ Functions/Zle/read-from-minibuffer | 5 ++++- Src/Zle/zle_utils.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1290497ae..7679d4ed8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2015-07-13 Oliver Kiddle + * 35737: (tweaked c.f. Peter: 35759): Src/Zle/zle_utils.c, + Functions/Zle/read-from-minibuffer: use new undo limit for + minibuffer and beep when limit is reached + * 35756: Completion/Zsh/Type/_ps1234: use the actual colours in the completion list for terminal colours diff --git a/Functions/Zle/read-from-minibuffer b/Functions/Zle/read-from-minibuffer index 8fec1105e..09dc68f97 100644 --- a/Functions/Zle/read-from-minibuffer +++ b/Functions/Zle/read-from-minibuffer @@ -20,7 +20,7 @@ done (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) local readprompt="$1" lbuf_init="$2" rbuf_init="$3" -integer changeno=$UNDO_CHANGE_NO +integer savelim=$UNDO_LIMIT_NO changeno=$UNDO_CHANGE_NO { # Use anonymous function to make sure special values get restored, @@ -43,6 +43,8 @@ integer changeno=$UNDO_CHANGE_NO else local NUMERIC unset NUMERIC + zle split-undo + UNDO_LIMIT_NO=$UNDO_CHANGE_NO zle recursive-edit -K main stat=$? (( stat )) || REPLY=$BUFFER @@ -52,6 +54,7 @@ integer changeno=$UNDO_CHANGE_NO # This removes the edits relating to the read from the undo history. # These aren't useful once we get back to the main editing buffer. zle undo $changeno + UNDO_LIMIT_NO=savelim } return $stat diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c index 198c0baa3..8b55403b3 100644 --- a/Src/Zle/zle_utils.c +++ b/Src/Zle/zle_utils.c @@ -1587,7 +1587,7 @@ undo(char **args) if (prev->changeno < last_change) break; if (prev->changeno < undo_limitno && !*args) - break; + return 1; if (unapplychange(prev)) curchange = prev; else