New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix and refactor symbol-highlight-transient-state
#16382
Merged
smile13241324
merged 3 commits into
syl20bnr:develop
from
fnussbaum:symbol-highlight-search-direction
May 15, 2024
Merged
Fix and refactor symbol-highlight-transient-state
#16382
smile13241324
merged 3 commits into
syl20bnr:develop
from
fnussbaum:symbol-highlight-search-direction
May 15, 2024
Conversation
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
fnussbaum
force-pushed
the
symbol-highlight-search-direction
branch
from
May 3, 2024 20:28
f303790
to
8a85819
Compare
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'.
Also fix docstrings and formatting.
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.
fnussbaum
force-pushed
the
symbol-highlight-search-direction
branch
from
May 4, 2024 18:29
8a85819
to
533b7df
Compare
I've been testing this locally, did not find any regression, issue was fixed |
smile13241324
approved these changes
May 15, 2024
ViktorHaag
pushed a commit
to ViktorHaag/spacemacs
that referenced
this pull request
May 16, 2024
* [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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix some issues with the
symbol-highlight-transient-state
. In particular this PR fixes #16380. It also simplifies the control flow and fixes some formatting and docstrings. The commit messages and comments contain a detailed breakdown of the changes.