Ver código fonte

Support linewise region.

Fixes #267.
pull/342/head
Daniel Shahaf 8 anos atrás
pai
commit
a7a7f8b422
1 arquivos alterados com 16 adições e 1 exclusões
  1. +16
    -1
      zsh-syntax-highlighting.zsh

+ 16
- 1
zsh-syntax-highlighting.zsh Ver arquivo

@ -115,7 +115,22 @@ _zsh_highlight()
# Re-apply zle_highlight settings
# 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_ACTIVE )) && (( YANK_ACTIVE )) && _zsh_highlight_apply_zle_highlight paste standout "$YANK_START" "$YANK_END"

Carregando…
Cancelar
Salvar