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>
|
||
|---|---|---|
| .. | ||
| bisect | ||
| branch | ||
| cherry_pick | ||
| commit | ||
| config | ||
| conflicts | ||
| custom_commands | ||
| demo | ||
| diff | ||
| file | ||
| filter_and_search | ||
| filter_by_author | ||
| filter_by_path | ||
| interactive_rebase | ||
| misc | ||
| patch_building | ||
| reflog | ||
| remote | ||
| shared | ||
| shell_commands | ||
| staging | ||
| stash | ||
| status | ||
| submodule | ||
| sync | ||
| tag | ||
| ui | ||
| undo | ||
| worktree | ||
| test_list.go | ||
| test_list_generator.go | ||
| tests.go | ||