1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-01 05:16:05 +01:00

37567: use (Z:n:) to split the buffer into words so line breaks are treated as whitespace

This commit is contained in:
Barton E. Schaefer 2016-01-13 19:50:24 -08:00
parent 5cf6ae0056
commit c275839033
2 changed files with 8 additions and 3 deletions

View file

@ -3,6 +3,11 @@
* 37590: Src/Zle/zle_hist.c, Src/Zle/zle_main.c: Invoke
zle-line-pre-redraw during isearch.
2016-01-13 Barton E. Schaefer <schaefer@zsh.org>
* 37567: Functions/Zle/match-words-by-style: use (Z:n:) to split
the buffer into words so line breaks are treated as whitespace
2016-01-13 Daniel Shahaf <d.s@daniel.shahaf.name>
* 37591: Src/hashtable.c, Test/A02alias.ztst: 37591: 'alias -L':

View file

@ -111,20 +111,20 @@ done
case $wordstyle in
(*shell*) local bufwords
# This splits the line into words as the shell understands them.
bufwords=(${(z)LBUFFER})
bufwords=(${(Z:n:)LBUFFER})
nwords=${#bufwords}
wordpat1="${(q)bufwords[-1]}"
# Take substring of RBUFFER to skip over $skip characters
# from the cursor position.
bufwords=(${(z)RBUFFER[1+$skip,-1]})
bufwords=(${(Z:n:)RBUFFER[1+$skip,-1]})
wordpat2="${(q)bufwords[1]}"
spacepat='[[:space:]]#'
# Assume the words are at the top level, i.e. if we are inside
# 'something with spaces' then we need to ignore the embedded
# spaces and consider the whole word.
bufwords=(${(z)BUFFER})
bufwords=(${(Z:n:)BUFFER})
if (( ${#bufwords[$nwords]} > ${#wordpat1} )); then
# Yes, we're in the middle of a shell word.
# Find out what's in front.