From 8ce654afb58e1b5fb619144e2eb12142d448976b Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 4 Apr 2002 11:59:08 +0000 Subject: 16933: more sophisticated versions of these functions --- Functions/Zle/down-line-or-beginning-search | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'Functions/Zle/down-line-or-beginning-search') diff --git a/Functions/Zle/down-line-or-beginning-search b/Functions/Zle/down-line-or-beginning-search index 881150171..8a8ed8994 100644 --- a/Functions/Zle/down-line-or-beginning-search +++ b/Functions/Zle/down-line-or-beginning-search @@ -1,13 +1,19 @@ # Like down-line-or-search, but uses the whole line prefix up to the # cursor position for searching forwards. -if [[ $LASTWIDGET != $WIDGET ]] +if [[ ${+NUMERIC} -eq 0 && + ( $LASTWIDGET = $__searching || $RBUFFER != *$'\n'* ) ]] then - if [[ $LBUFFER == *$'\n'* ]] - then - __last_down_line=down-line-or-history - else - __last_down_line=history-beginning-search-forward - fi + [[ $LASTWIDGET = $__searching ]] && CURSOR=$__savecursor + __searching=$WIDGET + __savecursor=$CURSOR + if zle .history-beginning-search-forward; then + [[ $RBUFFER = *$'\n'* ]] || + zstyle -T ':zle:down-line-or-beginning-search' leave-cursor && + zle .end-of-line + return + fi + [[ $RBUFFER = *$'\n'* ]] || return fi -zle .${__last_down_line:-beep} +__searching='' +zle .down-line-or-history -- cgit 1.4.1