From 7605a5302689c92d838e0617c74c31da455df238 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Mon, 13 Sep 1999 16:18:06 +0000 Subject: Initial revision --- Functions/Zle/history-search-end | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Functions/Zle/history-search-end (limited to 'Functions/Zle/history-search-end') diff --git a/Functions/Zle/history-search-end b/Functions/Zle/history-search-end new file mode 100644 index 000000000..24e7a0a87 --- /dev/null +++ b/Functions/Zle/history-search-end @@ -0,0 +1,28 @@ +# function history-search-end { +# +# This implements functions like history-beginning-search-{back,for}ward, +# but takes the cursor to the end of the line after moving in the +# history, like history-search-{back,for}ward. To use them: +# zle -N history-beginning-search-backward-end history-search-end +# zle -N history-beginning-search-forward-end history-search-end +# bindkey '...' history-beginning-search-backward-end +# bindkey '...' history-beginning-search-forward-end + +integer ocursor=$CURSOR + +if [[ $LASTWIDGET = history-beginning-search-*-end ]]; then + # Last widget called set $hbs_pos. + CURSOR=$hbs_pos +else + hbs_pos=$CURSOR +fi + +if zle .${WIDGET%-end}; then + # success, go to end of line + zle .end-of-line +else + # failure, restore position + CURSOR=$ocursor + return 1 +fi +# } -- cgit 1.4.1