For easily extending the highlighting behavior, split the actual highlighting function into some pieces. For example "_zsh_main-highlight" transformed into, 1) An actual highlighting function which updates the `region_highlight` on its own. (_zsh_main-highlight) 2) A predicate which determines whether its highlighting function (in this case `_zsh_main-highlight`) should be called or not. (_zsh_buffer-modified-p) Likewise, `_zsh_highlight-bracket-match` and `_zsh_highlight-bracket-match-p` are born. Eventually, `_zsh_highlight-zle-buffer` coordinates above these functions and maintain some internal state variables. Finally, added `_zsh_add-highlighter` a little syntactic-sugar-ish function to register the highlighting functions in an appropriate manner. Signed-off-by: Takeshi Banse <takebi@laafc.net>
13 KiB
13 KiB