Skip to content
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 several highlighting issues that occur during menu navigation #52

Merged
merged 3 commits into from
Jul 7, 2023

Conversation

theofabilous
Copy link
Contributor

@theofabilous theofabilous commented Jul 7, 2023

Originally part of #49

This fixes the updating of preview highlights when:

  • closing a submenu and returning to a parent menu
  • reopening a submenu that was previously closed

See the GIFs below for a comparison of the behavior before and after.

Before

bad

After

good

This also fixes the updating of current context highlights when returning to a submenu. Prior to these changes, returning to a parent menu would retain the context highlight of the menu entry that was the parent.

Finally, the hover highlighting in menus would never update if quick navigation was disabled, which has been fixed.

Tasks

  • Failing one test in menu_spec.lua

- remove the check if cursor is same as prev_cursor field, which
  prevents preview updating when returning to an existing menu window
When a submenu is closed and the parent menu regains focus, restore the
context highlight if it is set (i.e. if the cursor field is set).
Otherwise clear the context highlight.
In CursorMoved autocmd, the prev_cursor field is only updated through
the quick_navigation function. The hover highlight update takes the
prev_cursor field as an argument and so prior to this fix, the hover
highlight would only be updated when the quick navigation config option
was enabled
@theofabilous
Copy link
Contributor Author

Now passing the previously failing test. The implementation that fixes preview highlighting when returning to an existing menu differs from what I had done in #49 (which I originally used for this PR), so instead of adding a commit that rolls back changes in previous commits I rebased and force pushed to keep the commit sequence clean.

The behaviour is the same as before (save the bug caught by the tester). Marking this as ready for review

@theofabilous theofabilous marked this pull request as ready for review July 7, 2023 20:12
@Bekaboo Bekaboo merged commit c3e9dd3 into Bekaboo:fix-highlight Jul 7, 2023
Bekaboo pushed a commit that referenced this pull request Jul 8, 2023
* fix(menu): preview doesn't update on menu reopen

- remove the check if cursor is same as prev_cursor field, which
  prevents preview updating when returning to an existing menu window

* fix(menu): context highlight not restored when submenu closed

When a submenu is closed and the parent menu regains focus, restore the
context highlight if it is set (i.e. if the cursor field is set).
Otherwise clear the context highlight.

* fix(menu): hover highlight broken if quick navigation disabled

In CursorMoved autocmd, the prev_cursor field is only updated through
the quick_navigation function. The hover highlight update takes the
prev_cursor field as an argument and so prior to this fix, the hover
highlight would only be updated when the quick navigation config option
was enabled
@theofabilous theofabilous deleted the fix-highlight branch July 8, 2023 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants