diff options
author | Marc Cornellà <marc.cornella@live.com> | 2015-11-30 18:11:11 +0100 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2015-11-30 18:11:11 +0100 |
commit | a19ec1040e20e76baf9ff4f6024d511edda3293e (patch) | |
tree | eacb20c4410ae3b84a15fd71a615bb2499070437 /plugins/zsh-navigation-tools/n-list | |
parent | afd28bf1fc22f53c4a1af3f5836ca428affb34b3 (diff) | |
parent | 39e4dfb6a60cba39a47df68764075d841829be49 (diff) | |
download | zsh-a19ec1040e20e76baf9ff4f6024d511edda3293e.tar.gz zsh-a19ec1040e20e76baf9ff4f6024d511edda3293e.tar.bz2 zsh-a19ec1040e20e76baf9ff4f6024d511edda3293e.zip |
Merge pull request #4649 from psprint/master
znt: n-history supports multi-line cmds and starts with current buffer
Fixes #4648
Diffstat (limited to 'plugins/zsh-navigation-tools/n-list')
-rw-r--r-- | plugins/zsh-navigation-tools/n-list | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list index 3b326515e..c7066318e 100644 --- a/plugins/zsh-navigation-tools/n-list +++ b/plugins/zsh-navigation-tools/n-list @@ -139,6 +139,7 @@ if [ "$#" -lt 1 ]; then fi REPLY="-1" +typeset -ga reply reply=() integer term_height="$LINES" @@ -188,6 +189,11 @@ if [ "$NLIST_START_IN_SEARCH_MODE" -eq 1 ]; then NLIST_IS_SEARCH_MODE=1 fi +if [ -n "$NLIST_SET_SEARCH_TO" ]; then + NLIST_SEARCH_BUFFER="$NLIST_SET_SEARCH_TO" + NLIST_SET_SEARCH_TO="" +fi + if [ "$NLIST_START_IN_UNIQ_MODE" -eq 1 ]; then NLIST_START_IN_UNIQ_MODE=0 NLIST_IS_UNIQ_MODE=1 @@ -281,6 +287,9 @@ while (( 1 )); do if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" disp_list=( "${(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + + # We have display list, lets replace newlines with "\n" when needed (1/3) + [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) fi # Output colored list @@ -333,11 +342,17 @@ while (( 1 )); do if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" disp_list=( "${(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + + # We have display list, lets replace newlines with "\n" when needed (2/3) + [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) fi else if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" disp_list=( "${(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + + # We have display list, lets replace newlines with "\n" when needed (3/3) + [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) fi fi |