浏览代码

Support linewise region.

Fixes #267.
pull/342/head
Daniel Shahaf 8 年前
父节点
当前提交
a7a7f8b422
共有 1 个文件被更改,包括 16 次插入1 次删除
  1. +16
    -1
      zsh-syntax-highlighting.zsh

+ 16
- 1
zsh-syntax-highlighting.zsh 查看文件

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

正在加载...
取消
保存