Skip to content

Commit

Permalink
fix(menu): preview not updated after returning to prev menu
Browse files Browse the repository at this point in the history
Bug:    After returning from a sub-menu to its previous menu, the
        preview of the symbol under cursor in the previous menu
        is not started.
Fix:     The issue stems from the conditional check in
         `dropbar_menu_t:preview_symbol_at()`. It compares the component
         to be previewed with `self.symbol_previewed` and returns early
         if they match, aiming to reduce unnecessary calls to
         `dropbar_symbol_t:preview()`. However, this approach becomes
         problematic when returning from sub-menus to their previous
         menus, as the `symbol_previewed` of the previous menu
         consistently matches the symbol under the cursor, preventing
         the symbol's preview from starting. Removing the check fixes
         the issue.
  • Loading branch information
bekaboo committed Jan 8, 2024
1 parent 0fcb0c7 commit bfba257
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/dropbar/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ function dropbar_menu_t:preview_symbol_at(pos, look_ahead)
return
end
local component = self:get_component_at(pos, look_ahead)
if not component or component == self.symbol_previewed then
if not component then
return
end
component:preview(self.symbol_previewed and self.symbol_previewed.view)
Expand Down

0 comments on commit bfba257

Please sign in to comment.