main: Add buf_offset variable

No functional change.
This commit is contained in:
Matthew Martin 2018-03-10 14:34:46 -06:00
parent 49cc5e25b8
commit dbce7317c7

View file

@ -68,10 +68,9 @@ _zsh_highlight_main_add_region_highlight() {
local reply local reply
shift 2 shift 2
# The calculation was relative to $PREBUFFER$BUFFER, but region_highlight is # The calculation was relative to $buf but region_highlight is relative to $BUFFER.
# relative to $BUFFER. (( start += buf_offset ))
(( start -= $#PREBUFFER )) (( end += buf_offset ))
(( end -= $#PREBUFFER ))
(( start >= end )) && { print -r -- >&2 "zsh-syntax-highlighting: BUG: _zsh_highlight_main_add_region_highlight: start($start) >= end($end)"; return } (( start >= end )) && { print -r -- >&2 "zsh-syntax-highlighting: BUG: _zsh_highlight_main_add_region_highlight: start($start) >= end($end)"; return }
(( end <= 0 )) && return (( end <= 0 )) && return
@ -228,7 +227,7 @@ _zsh_highlight_highlighter_main_paint()
fi fi
## Variable declarations and initializations ## Variable declarations and initializations
local start_pos=0 end_pos highlight_glob=true arg style local start_pos=0 end_pos buf_offset=-$#PREBUFFER highlight_glob=true arg style
local in_array_assignment=false # true between 'a=(' and the matching ')' local in_array_assignment=false # true between 'a=(' and the matching ')'
typeset -a ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR typeset -a ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR
typeset -a ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS typeset -a ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS