Skip to content

Conversation

@rcdailey
Copy link

PR Description

Fixes the bug where navigating search results with n (next) or N (previous) in list contexts (e.g., commits panel) correctly updates the selection in the side panel but does not refresh the main panel to show the newly selected item's details.

Changes Made

  • Added self.Context.HandleRenderToMain() call in OnSearchSelect() function in pkg/gui/context/list_context_trait.go:120
  • This ensures the main panel explicitly refreshes when navigating search results, matching the behavior of normal arrow key navigation

Testing

Manually tested:

  1. Opened lazygit in a git repository
  2. Navigated to commits panel
  3. Pressed / to start search
  4. Typed search term matching multiple commits
  5. Pressed n to navigate to next match
  6. Verified main panel now updates to show the diff for the newly selected commit

Checklist

  • Code has been formatted (gofumpt)
  • Cheatsheets are up-to-date (no keybinding changes)
  • Tests have been added/updated (N/A - simple one-line fix)
  • Text is internationalised (no new text added)
  • Docs have been updated if necessary (no docs changes needed)
  • You've read through your own file changes for silly mistakes etc

When using search (/) in list contexts and navigating with n/N,
the selected item in the side panel updated correctly but the main
panel did not refresh to show the newly selected item's details.

This fix adds an explicit HandleRenderToMain() call in OnSearchSelect()
to ensure the main panel updates when navigating search results,
matching the behavior of normal arrow key navigation.
@stefanhaller
Copy link
Collaborator

This already works for me on master; the HandleFocus call takes care of rendering the main view. If this doesn't work for you, then we need to find out why, but the proposed "fix" doesn't look right.

@rcdailey
Copy link
Author

You're right, I didn't look hard enough. And now that I'm trying to reproduce the issue again I'm not able to (running v0.55.1). I apologize for the oversight. There must be some other conditions that need to be met to reproduce the issue. I'll close this PR but if it happens again I'll try to pay attention to reproduction steps.

Thanks for the quick reply!

@rcdailey rcdailey closed this Oct 11, 2025
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