File tree 3 files changed +15
-8
lines changed
3 files changed +15
-8
lines changed Original file line number Diff line number Diff line change 34
34
# Whether the cursor highlighter should be called or not.
35
35
_zsh_highlight_cursor_highlighter_predicate ()
36
36
{
37
- # accept-* may trigger removal of cursor highlighting
38
- [[ $WIDGET == accept-* ]] ||
39
- _zsh_highlight_cursor_moved
37
+ # widgets which accept lines may trigger removal of cursor highlighting
38
+ _zsh_highlight_cursor_moved || _zsh_highlight_is_accept_line_type_widget
40
39
}
41
40
42
41
# Cursor highlighting function.
43
42
_zsh_highlight_cursor_highlighter ()
44
43
{
45
- [[ $WIDGET == accept- * ]] && return
46
-
44
+ _zsh_highlight_is_accept_line_type_widget && return
45
+
47
46
region_highlight+=(" $CURSOR $(( $CURSOR + 1 )) $ZSH_HIGHLIGHT_STYLES [cursor]" )
48
47
}
Original file line number Diff line number Diff line change 60
60
# Whether the highlighter should be called or not.
61
61
_zsh_highlight_main_highlighter_predicate ()
62
62
{
63
- # accept-* may trigger removal of path_prefix highlighting
64
- [[ $WIDGET == accept- * ]] ||
63
+ # widgets which accept lines may trigger removal of path_prefix highlighting
64
+ _zsh_highlight_is_accept_line_type_widget ||
65
65
_zsh_highlight_buffer_modified
66
66
}
67
67
@@ -455,7 +455,7 @@ _zsh_highlight_main_highlighter_check_path()
455
455
456
456
# If this word ends the buffer, check if it's the prefix of a valid path.
457
457
if [[ ${BUFFER[1]} != " -" && ${# BUFFER} == $end_pos ]] &&
458
- [[ $WIDGET != accept- * ]] ; then
458
+ ! _zsh_highlight_is_accept_line_type_widget ; then
459
459
local -a tmp
460
460
tmp=( ${expanded_path} * (N) )
461
461
(( $# tmp > 0 )) && style_override=path_prefix && return 0
Original file line number Diff line number Diff line change @@ -174,6 +174,14 @@ _zsh_highlight_cursor_moved()
174
174
[[ -n $CURSOR ]] && [[ -n ${_ZSH_HIGHLIGHT_PRIOR_CURSOR-} ]] && (( $_ZSH_HIGHLIGHT_PRIOR_CURSOR != $CURSOR ))
175
175
}
176
176
177
+ # Whether the current widget is an accept-line type widget.
178
+ #
179
+ # Returns 0 if the the current widget is an accept-line type widget.
180
+ _zsh_highlight_is_accept_line_type_widget ()
181
+ {
182
+ [[ $1 == accept-* ]] || [[ $1 == zsh-isearch-exit ]]
183
+ }
184
+
177
185
178
186
# -------------------------------------------------------------------------------------------------
179
187
# Setup functions
You can’t perform that action at this time.
0 commit comments