Skip to content

Commit

Permalink
No need to prepare (clear) zui-process-buffer* output variables
Browse files Browse the repository at this point in the history
  • Loading branch information
psprint committed Feb 17, 2017
1 parent a311e77 commit 1e9387c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 0 additions & 4 deletions zui-list
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,6 @@ trap "REPLY=-2; reply=(); return" TERM INT QUIT
[[ "$ZUILIST_CURRENT_SEGMENT" -gt "$nseg" ]] && ZUILIST_CURRENT_SEGMENT="$nseg"
integer active_segment="$ZUILIST_CURRENT_SEGMENT"

# Prepare output variables for zui-process-buffer
local ZUI_PB_WORDS="" ZUI_PB_WORDS_BEGINNINGS="" ZUI_PB_SPACES=""
local ZUI_PB_SELECTED_WORD="" ZUI_PB_LEFT="" ZUI_PB_RIGHT=""

# Lets find interesting segment and mark it with \7...\31
zui-process-buffer "$element"
integer size="${#ZUI_PB_WORDS}" i
Expand Down
3 changes: 3 additions & 0 deletions zui-process-buffer
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ local MBEGIN MEND MATCH mbegin mend match
local buf="${1:-$BUFFER}"
local cursor="${2:-$CURSOR}"

# All output variables are either overwritten or cleared
ZUI_PB_WORDS=( "${(Z+n+)buf}" )
ZUI_PB_SPACES=( )
ZUI_PB_WORDS_BEGINNINGS=( )
ZUI_PB_SELECTED_WORD="-1"
ZUI_PB_LEFT=""
ZUI_PB_RIGHT=""

# (Z+n+) will return 1 element for buf that is empty or only whitespace
if [[ "$buf" = ( |$'\t')# ]]; then
Expand Down
1 change: 1 addition & 0 deletions zui-process-buffer2
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ local MBEGIN MEND MATCH mbegin mend match

local buf="${1:-$BUFFER}"

# All output variables are either overwritten or cleared
ZUI_PB2_WORDS=( "${(Z+n+)buf}" )
ZUI_PB2_QWORDS=( )
ZUI_PB2_SPACES=( )
Expand Down

0 comments on commit 1e9387c

Please sign in to comment.