mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-11 08:06:25 -04:00
The focused main view always showed a selection while it held focus, even when
its content was a placeholder ("No changed files", a merge-conflict message)
rather than a diff — so pressing a navigation key conjured a highlighted line
over "No changed files", and discarding the last change (or changes vanishing
outside lazygit) left a stale selection behind.
A selection should only show when there are change lines to act on. Two
moments establish or change the content:
- Focus: showInitialDiffSelection now leaves the selection off when the view
has no change lines (ViewHasChangeLines), rather than highlighting a stray
line at the top.
- Render: the side panel's render-to-main is where it decides between a diff
and a placeholder, so that's where the selection's visibility is set —
updateFocusedMainViewSelectionVisibility shows it only on the focused pane
and only when a diff is being rendered. This covers the refresh cases that
focus can't: discarding the last change, and changes disappearing or
reappearing outside lazygit, all hide or restore the selection on the next
refresh. (Focusing reuses the already-rendered content rather than
re-rendering, which is why focus needs its own check.)
Wired into the files panel, where placeholders occur; the commit panels always
render a diff. Adds a SelectionIsShown/SelectionIsHidden test assertion.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| amend_helper.go | ||
| app_status_helper.go | ||
| bisect_helper.go | ||
| branches_helper.go | ||
| cherry_pick_helper.go | ||
| commit_files_helper.go | ||
| commits_helper.go | ||
| commits_helper_test.go | ||
| confirmation_helper.go | ||
| credentials_helper.go | ||
| diff_helper.go | ||
| diff_line_navigation.go | ||
| diff_line_navigation_test.go | ||
| diff_line_parser.go | ||
| diff_line_parser_test.go | ||
| drag_autoscroller.go | ||
| drag_autoscroller_test.go | ||
| files_helper.go | ||
| fixup_helper.go | ||
| fixup_helper_test.go | ||
| gpg_helper.go | ||
| helpers.go | ||
| host_helper.go | ||
| inline_status_helper.go | ||
| menu_key.go | ||
| merge_and_rebase_helper.go | ||
| merge_conflicts_helper.go | ||
| mode_helper.go | ||
| patch_building_helper.go | ||
| record_directory_helper.go | ||
| refresh_helper.go | ||
| refresh_helper_test.go | ||
| refs_helper.go | ||
| repos_helper.go | ||
| search_helper.go | ||
| signal_handling.go | ||
| signal_handling_windows.go | ||
| snake_helper.go | ||
| staging_helper.go | ||
| sub_commits_helper.go | ||
| suggestions_helper.go | ||
| suspend_resume_helper.go | ||
| tags_helper.go | ||
| update_helper.go | ||
| upstream_helper.go | ||
| upstream_helper_test.go | ||
| view_helper.go | ||
| window_arrangement_helper.go | ||
| window_arrangement_helper_test.go | ||
| window_helper.go | ||
| working_tree_helper.go | ||
| worktree_helper.go | ||
| worktree_helper_test.go | ||