Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Slow highlighting (Re: "drop-in replacement" and transpose-words-match)

On 24 January 2016 at 07:20, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Jan 23, 11:53pm, Daniel Shahaf wrote:
> }
> } [Re-analyzing on every keystroke] doesn't explain the slowness on
> } fned buffers: the initial highlight of an fned buffer involves exactly
> } one _zsh_highlight call, and yet is slow.
> Is it similarly slow on any use of "vared"?  What about with a history
> line containing a function definition?

Isn't it that zsyh does a fork for each token it analyzes?

# NOTE: This runs 'setopt', but that should be safe since it'll only ever be
# called inside a $(...) subshell, so the effects will be local.
_zsh_highlight_main__type() {
  if (( $#options_to_set )); then
    setopt $options_to_set;
  LC_ALL=C builtin type -w -- $1 2>/dev/null

      local res="$(_zsh_highlight_main__type ${expanded_arg})"
      case $res in
        *': reserved')  style=$ZSH_HIGHLIGHT_STYLES[reserved-word];;
        *': suffix alias')
        *': alias')     () {

Best regards,
Sebastian Gniazdowski

Messages sorted by: Reverse Date, Date, Thread, Author