Support linewise region.

Fixes #267.
This commit is contained in:
Daniel Shahaf 2016-05-09 04:06:44 +00:00
parent 15db71abd0
commit a7a7f8b422

View file

@ -115,7 +115,22 @@ _zsh_highlight()
# Re-apply zle_highlight settings # Re-apply zle_highlight settings
# region # region
(( REGION_ACTIVE )) && _zsh_highlight_apply_zle_highlight region standout "$MARK" "$CURSOR" if (( REGION_ACTIVE == 1 )); then
_zsh_highlight_apply_zle_highlight region standout "$MARK" "$CURSOR"
elif (( REGION_ACTIVE == 2 )); then
() {
local needle=$'\n'
integer min max
if (( MARK > CURSOR )) ; then
min=$CURSOR max=$MARK
else
min=$MARK max=$CURSOR
fi
(( min = ${${BUFFER[1,$min]}[(I)$needle]} ))
(( max += ${${BUFFER:($max-1)}[(i)$needle]} - 1 ))
_zsh_highlight_apply_zle_highlight region standout "$min" "$max"
}
fi
# yank / paste (zsh-5.1.1 and newer) # yank / paste (zsh-5.1.1 and newer)
(( $+YANK_ACTIVE )) && (( YANK_ACTIVE )) && _zsh_highlight_apply_zle_highlight paste standout "$YANK_START" "$YANK_END" (( $+YANK_ACTIVE )) && (( YANK_ACTIVE )) && _zsh_highlight_apply_zle_highlight paste standout "$YANK_START" "$YANK_END"