znt: n-history supports multi-line cmds and starts with current buffer

This commit is contained in:
Sebastian Gniazdowski
2015-11-30 10:48:30 +01:00
parent afd28bf1fc
commit c2b4d9ff40
5 changed files with 27 additions and 3 deletions

View File

@@ -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