-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix and refactor
symbol-highlight-transient-state
(#16382)
* [symbol-highlight-ts] Do not restart the transient state unnecessarily Previously the ts was restarted on every invocation of `spacemacs//quick-ahs-move'. This is not necessary and led to the :on-exit-function being called every time. Instead, we now only start the transient state in all of the entry points: `spacemacs/enter-ahs-forward', `spacemacs/enter-ahs-backward', `spacemacs/goto-last-searched-ahs-symbol' and `spacemacs/symbol-highlight'. Note that `spacemacs//ahs-setup' needs to be called before every entry point. In `spacemacs//quick-ahs-move' we still have to call `ahs-highlight-now' to prevent blocking. Finally, the change allows us to simplify `spacemacs//disable-symbol-highlight-after-ahs-ts-exit'. * [symbol-highlight-ts] Do not enter the ts if no symbol is found at point Also fix docstrings and formatting. * [symbol-highlight-ts] Fix and simplify evil search integration It suffices to do the evil search integration once when leaving the transient state. This also fixes an issue where, when `evil-search-module' was `evil-search', the search direction could be inconsistent after leaving the transient state: Starting in the transient state, and pressing 'N q N' would make the second 'N' move in the opposite direction of the first 'N'. To be consistent with expectations (and vanilla evil or vim) the search direction should be determined only by the function invoking the transient state (for example through the keys '*' or '#'), and not by how one moved inside it. Finally we use `thing-at-point' instead of `evil-find-thing' because the latter searches forward or backward while the transient state only looks at the symbol at point. Due to the user-error introduced in the last commit it does not practically matter (point should always already be at a symbol), but it might still be a good thing to stay consistent.
- Loading branch information
Showing
1 changed file
with
116 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters