mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-12-04 21:56:45 +01:00
driver: Always bind zle-line-finish and use it instead of accept-*
Special handling for cursor imprint or partial path highlighting is needed in more cases than accept-*. For example when accepting a line from isearch, no accept-* widget is invoked. The proper way is to use zle-line-finish. Trumps #259. Fixes #284.
This commit is contained in:
parent
9e569bb0fe
commit
5bae621900
4 changed files with 13 additions and 9 deletions
|
|
@ -34,15 +34,14 @@
|
|||
# Whether the cursor highlighter should be called or not.
|
||||
_zsh_highlight_cursor_highlighter_predicate()
|
||||
{
|
||||
# accept-* may trigger removal of cursor highlighting
|
||||
[[ $WIDGET == accept-* ]] ||
|
||||
_zsh_highlight_cursor_moved
|
||||
# remove cursor highlighting when the line is finished
|
||||
[[ $WIDGET == zle-line-finish ]] || _zsh_highlight_cursor_moved
|
||||
}
|
||||
|
||||
# Cursor highlighting function.
|
||||
_zsh_highlight_cursor_highlighter()
|
||||
{
|
||||
[[ $WIDGET == accept-* ]] && return
|
||||
[[ $WIDGET == zle-line-finish ]] && return
|
||||
|
||||
_zsh_highlight_add_highlight $CURSOR $(( $CURSOR + 1 )) cursor
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue