summaryrefslogtreecommitdiff
path: root/plugins/zsh-navigation-tools/n-list
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/zsh-navigation-tools/n-list')
-rw-r--r--plugins/zsh-navigation-tools/n-list15
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