zsh-syntax-highlighting: history-incremental-pattern-search-backward is broken after upgrading to zsh 5.3.1
I recently upgraded zsh from 5.2-2 -> 5.3.1-1, in Arch Linux. After upgrading, history-incremental-pattern-search-backward and history-incremental-pattern-search-forward no longer work. That is, they show the most recent match, then failing bck-i-search: foo, then one other match from eons ago, then it fails to find any more. Reverting to zsh 5.2-2 fixes this problem.
I use zim. When I disable zsh-syntax-highlighting, pattern searching works again. I tried creating a new minimal zsh install, that did not source zim at all. As soon as I directly source zsh-syntax-highlighting, pattern searching breaks again. Unlike issue #387, I’m not using zsh-autocorrect.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 28 (20 by maintainers)
Fixed in upstream with https://github.com/zsh-users/zsh/commit/48cadf48ff9c61ce09e826ad9a58e250e999a262 http://www.zsh.org/mla/workers//2017/msg00034.html
No worries.
I’m mortified that Debian was quicker than Arch with this! 😧
@protist Correct. The argument for 5.3.1.1 over 5.3.2 is that it would be correct even if zsh started using x.y.z.w. The arguments for 5.3.2 over 5.3.1.1 are that it suffices given upstream’s release numbering policy (as you say) and that it’s better to be conservative due to the asymmetric failure modes (as pointed out by @docwhat).
During isearch, there will be no highlighting at all.
You’ll want to remember to revert your local mod when you upgrade to zsh≥5.3.2.
This is actually an upstream bug.
Minimal example without z-sy-h to reproduce:
The cause is that iseach uses the global
PAT_STATICpattern. But inside thezle-isearch-hookany function that uses patterns, too, will overwrite that pattern.I sent a patch to workers@.
This bug got introduced in #288, because we deliberately hooked
zle-isearch-updateto fix another bug. If a user would have hookedzle-isearch-updatehimself already, the bug would have already surfaced before.Question now is: Can we do anything on z-sy-h’s side to prevent triggering this?
This (pseudocode) should technically do it,
since we (luckily) don’t use any patterns before it. Of course we’d lose z-sy-h’s coloring again until then.
There’s no need; the only difference between zsh-5.3.1-0-g06b1b7a and zsh-5.3.1-1-gfa88f57 is a patch that changes the version number reporting. (zsh-users/zsh@fa88f57)
Nothing there accounts for the difference.
sigh
I see the problem. I was testing not with aac4a4423898fccbd1ab72c369ac09995a9139f1 but with that plus a local mod:
I can reproduce your behaviour when I revert that change.
That change is a rebase artifact from one of @movie’s pull requests (#288 or thereabouts; the referenced FAQ entry — “Does syntax highlighting work during incremental history search?” in README.md — points to that issue, too).
@m0vie, do you recall the background here? Did @protist’s use-case work at some point during 0.5.0 development? Can it be made to work (without disabling syntax highlighting)?