syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.56k stars 4.9k forks source link

`n` navigation key can search in the wrong direction after exiting `symbol-highlight-transient-state` #16380

Closed jwbowler closed 1 month ago

jwbowler commented 2 months ago

Description :octocat:

If you enter symbol-highlight-transient-state, search backward, and exit the transient state, n and N are now switched vs. their usual Vim-style behavior.

I have zero experience with ELisp, but, some things I observe from poking around layers/+spacemacs/spacemacs-navigation:

I observe this behavior on my freshly-installed MacOS Spacemacs as well as my Linux Spacemacs in the office.

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart: n now searches backward through "foo"s

Expected behaviour: :heart: :smile: n now searches forward through "foo"s

System Info :computer:

Backtrace :paw_prints:

N/A

fnussbaum commented 2 months ago

Thanks for the report, I have drafted a PR that would fix this: #16382

In the meantime, something like the following could serve as a workaround:

(defun fix/spacemacs//ahs-ts-on-exit ()
    (setq evil-ex-search-direction (if spacemacs--ahs-searching-forward 'forward 'backward)))
(advice-add 'spacemacs//ahs-ts-on-exit :after 'fix/spacemacs//ahs-ts-on-exit)