jesseduffield.lazygit/pkg
Stefan Haller 4e441127f3 Clear highlight in HandleFocusLost
Remove the old mechanism of clearing the highlight in Layout.

This fixes a problem with a wrong highlight showing up in the staging panel when
entering a file with only staged changes.

Reproduction recipe:
1. stage all changes in a file by pressing space on it in the files panel
2. enter the staged changes panel by pressing enter
3. unstage one of the changes
This makes the unstaged changes panel visible, but keeps the focus in the staged
changes panel. However, the highlight in the unstaged changes view becomes
visible, as if it were focused.

To explain why this happens, you need to know how the selection highlighting of
a view is turned on or off. It is turned on when it gains the focus, i.e. when
ActivateFocus is called on it, which in turn happens when PushContext is called.
It is turned off in Layout when gocui sees that the current view is no longer
the same as last time, in which case it calls onViewFocusLost on the previous
current view.

This mechanism only works reliably when there is at most one PushContext call
per event handler. If there is more than one, then the first one gets its
highlight turned on, then the second one, but since gocui has never seen the
first one as the active view in Layout, it doesn't get the highlight turned off
again even though it should.

And this happens in the above scenario. When pressing enter on a file with only
staged changes, we first push the staging context (in
FilesController.EnterFile), and then later we push the stagingSecondary context
when we realize we only have staged changes. This leaves the highlight of the
staging context on.
2024-06-23 13:21:49 +02:00
..
app Add -profile command line flag 2024-06-03 19:07:24 +02:00
cheatsheet Render keybinding cheatsheet as markdown table 2024-01-28 08:12:01 +11:00
commands Fix custom patch operations on added files 2024-06-23 12:40:31 +02:00
common Add AppState to common.Common 2023-09-04 17:48:39 +02:00
config Add user config gui.commitAuthorFormat 2024-06-15 10:39:50 +04:00
constants Make the links in the status panel point to the current version rather than master 2024-03-22 08:13:59 +01:00
env Support bare worktrees where worktree does not have its own .git file 2023-08-07 22:40:53 +10:00
fakes cleanup integration test code 2023-02-26 12:54:13 +11:00
gui Clear highlight in HandleFocusLost 2024-06-23 13:21:49 +02:00
i18n Always show the "Discard unchanged changes" menu item 2024-06-23 12:43:34 +02:00
integration Show radio buttons in the sort order menu for branches 2024-06-23 12:53:15 +02:00
jsonschema Fix boolean config keys not appearing in the generated Config.md 2024-05-31 20:07:58 +02:00
logs Remove secureexec package 2023-07-30 19:59:51 +10:00
snake integrate snake game into lazygit 2022-12-30 12:18:59 +11:00
tasks Use ScanLinesAndTruncateWhenLongerThanBuffer instead of bufio.ScanLines 2024-05-15 13:27:01 +02:00
theme pkg: fix some comment 2024-04-07 16:09:26 +08:00
updates Construct arg vector manually rather than parse string 2023-05-23 19:49:19 +10:00
utils Use utils.StringWidth to optimize rendering performance 2024-06-23 13:10:48 +02:00