Closed tmpm697 closed 1 year ago
I'm using this plugin and this but with latest update from master, substring search is not highlight all of its portion.
i.g:
for i in
-- this is substring to search through history, but onlyi in
is highlighted.This issue happens recently and I did test with latest tag
0.8.0-alpha1-pre-redrawhook
and it worked.
What changed recently?
What are the values of $ZSH_VERSION and $ZSH_HIGHLIGHT_REVISION and the revision of zsh-history-substring-search when the problem occurs?
Can yoiu bisect z-sy-h, keeping the versions of zsh and z-h-s-s constant? (It might well be the commit on master that's immediately after the tag; that tag wasn't a release but a marker of the point just before a topic branch merge.)
Can you reproduce the problem under 'zsh -f' after manually sourcing just those two plugins (by running the 'source' builtin at the prompt twice)?
Can you post more detailed reproduction steps? Assume no knowledge of third-party plugins.
This is steps:
1. zsh -df
2. source zsh-history-substring-search.zsh
3. source zsh-syntax-highlighting.zsh
4. source zsh-autosuggestions.zsh
5.
zle -N history-substring-search-up
zle -N history-substring-search-down
zle -N autosuggest-accept
bindkey -M emacs '^P' history-substring-search-up
bindkey -M emacs '^N' history-substring-search-down
<enter>
> for i in $(seq 1 10);d do ; done
> for i in<multiple ctrl-p here to match previous typed above command>
6. observer `for` is blinking
setup:
substring: 4abed97
highlighting: caa749d
auto suggestion: a411ef3
The steps need an explicit bindkey -e
since the default keymap isn't always emacs
.
I tried following your steps and I can reproduce a problem, but not the same one as you.
What I see is:
i
and the spaces before and after it (characters 4,5,6 in the buffer, counting from 1) are in bold white-on-magenta. (Dumping $region_highlight shows there's a '0 6 fg=white,bg=red,bold'
entry.)'0 6 fg=white,bg=magenta,bold'
entry.)for
sometimes flickers for a brief moment with red background, but then gets highlighted correctly and remains so.The dumped $region_highlight entries lack a memo=zsh-syntax-highlighting
annotation, whereas all other entries have those.
Which plugin would mark the first six characters as bold white-on-red or bold white-on-magenta?
The above is with zsh 5.9 and the same versions as you:
% for 1 in */ ; printf "%s\t%s\n" $(cd $1 && git rev-parse HEAD) $1:t
a411ef3e0992d4839f0732ebeb9823024afaaaa8 zsh-autosuggestions
4abed97b6e67eb5590b39bcd59080aa23192f25d zsh-history-substring-search
caa749d030d22168445c4cb97befd406d2828db0 zsh-syntax-highlighting
By the way, zsh-history-substring-search overrides and reimplements some zsh-syntax-highlighting implementation details:
That's not supported. It falls under "If it breaks, you get to keep both pieces.". zsh-history-substring-search needs to stop doing that.
I don't know whether that does or doesn't cause this issue (#872).
But why use syntax-highlight tag 0.8.0-alpha1-pre-redrawhook
works?
this is what should look like:
but master branch gives:
I don't know. You're welcome to bisect this, of course, but my previous comment in this issue stands: your configuration is unsupported. No one should be defining functions named _zsh_highlight* except z-sy-h itself and authors of third-party highlighters conforming to z-sy-h's API; however, your configuration uses plugins that do exactly this.
So use z-sy-h with z-h-s-s is not supported due to override _zsh_highlight
function?. It's plugins, not configuration. I'd stay with 0.8.0 for a while, thanks for clarifying.
You can try to upgrade but manually disable the new codepath. (The old codepath is still there for compatibility with older versions of zsh.) Other than that, that's right, use of plugins that redefine z-sy-h's internal functions is unsupported.
Looks like someone PR'd this on the z-h-s-s side, https://github.com/zsh-users/zsh-history-substring-search/pull/135.
I'm using this plugin and this but with latest update from master, substring search is not highlight all of its portion.
i.g:
for i in
-- this is substring to search through history, but onlyi in
is highlighted and it will blinking onfor
part.This issue happens recently and I did test with latest tag
0.8.0-alpha1-pre-redrawhook
and it worked.