jesseduffield.lazygit/pkg/gui/context
Stefan Haller e90a3dc666 Fix view selection running out of sync with list selection when view isn't focused
When rerendering a view at the end of a refresh, we call HandleFocus only if the
view has the focus. This is so that we rerender the main view for the new
selection.

What was missing here is to update the view selection from the list selection if
the view doesn't have the focus, so that the selection is painted properly.
Normally this is not relevant because you don't see the selection if another
side panel has the focus; however, you do see it as an inactive selection when
e.g. a popup is shown, in which case it does matter.

This will become more important when we introduce section headers for commits,
because in that case the view selection needs to change when the working copy
state changes from normal to rebasing or vice versa, even if the list selection
stays the same.

The changed test submodule/reset.go shows how this was wrong before: when
entering the submodule again after resetting, there is a refresh which keeps the
same branch selected as before (master); however, since the branches panel is
not focused, the view didn't notice and kept thinking that the detached head is
selected (which it isn't, you can tell by running the test in sandbox mode and
focusing the branches panel at the end: you'll see that master is selected). So
the change in this commit fixes that.
2025-04-20 16:06:15 +02:00
..
traits Set mode to none when calling SetSelectionRangeAndMode with empty non-sticky range 2024-03-16 22:01:13 +01:00
base_context.go Remove return value of Focus-related functions 2024-09-06 08:45:48 +02:00
branches_context.go Fix truncating branches to the right edge of the view when scrolled to the left 2025-04-20 15:50:38 +02:00
commit_files_context.go Let users to define custom icons and color for files on the config file 2025-03-25 09:48:12 +01:00
commit_message_context.go Show "hooks disabled" in title bar of commit message editor 2025-04-10 08:57:32 +02:00
confirmation_context.go split context common from helper common 2023-04-30 13:19:53 +10:00
context.go Layout the bottom line view using spacer views 2023-12-09 11:18:28 +01:00
context_common.go split context common from helper common 2023-04-30 13:19:53 +10:00
dynamic_title_builder.go show namesake for child views 2022-03-26 18:00:46 +11:00
filtered_list.go Get rid of the retain-sort-order-when-filtering logic again 2024-03-17 12:23:07 +01:00
filtered_list_view_model.go Get rid of the retain-sort-order-when-filtering logic again 2024-03-17 12:23:07 +01:00
history_trait.go Add search history 2023-09-20 08:35:41 +03:00
list_context_trait.go Fix view selection running out of sync with list selection when view isn't focused 2025-04-20 16:06:15 +02:00
list_renderer.go Fix crash when viewing the divergence of a branch which is up to date with its upstream 2024-09-18 09:24:10 +02:00
list_renderer_test.go Cleanup: remove more unnecessary type arguments 2025-03-20 11:50:28 +01:00
list_view_model.go Reduce the chance of race condition with list cursor 2024-01-28 09:20:52 +11:00
local_commits_context.go Make WorkingTreeState a struct, and add cherry-picking and reverting states 2025-04-20 15:53:17 +02:00
menu_context.go Remove return value of IContextMgr.Push/Pop et. al. 2024-09-06 08:45:48 +02:00
merge_conflicts_context.go Bump gocui and adapt lazygit code 2024-12-01 10:40:08 +01:00
parent_context_mgr.go Remove bool return value of GetParentContext() 2024-08-17 11:14:51 +02:00
patch_explorer_context.go Rewrap patch when view width changes 2024-12-23 12:24:09 +01:00
reflog_commits_context.go Adjust line number for working copy when editing a line 2025-01-07 17:46:51 +01:00
remote_branches_context.go Adjust line number for working copy when editing a line 2025-01-07 17:46:51 +01:00
remotes_context.go Adjust line number for working copy when editing a line 2025-01-07 17:46:51 +01:00
search_trait.go Change direct access to Common.UserConfig to a getter 2024-08-18 10:24:52 +02:00
setup.go Layout the bottom line view using spacer views 2023-12-09 11:18:28 +01:00
simple_context.go Fix view selection running out of sync with list selection when view isn't focused 2025-04-20 16:06:15 +02:00
stash_context.go Adjust line number for working copy when editing a line 2025-01-07 17:46:51 +01:00
sub_commits_context.go Adjust line number for working copy when editing a line 2025-01-07 17:46:51 +01:00
submodules_context.go Get rid of the retain-sort-order-when-filtering logic again 2024-03-17 12:23:07 +01:00
suggestions_context.go Remove return value of HandleRender 2024-09-06 08:45:48 +02:00
tags_context.go Adjust line number for working copy when editing a line 2025-01-07 17:46:51 +01:00
view_trait.go Bump gocui and adapt lazygit code 2024-12-01 10:40:08 +01:00
working_tree_context.go Let users to define custom icons and color for files on the config file 2025-03-25 09:48:12 +01:00
worktrees_context.go Get rid of the retain-sort-order-when-filtering logic again 2024-03-17 12:23:07 +01:00