jesseduffield.lazygit/pkg/gui
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
..
context Clear highlight in HandleFocusLost 2024-06-23 13:21:49 +02:00
controllers Use utils.StringWidth to optimize rendering performance 2024-06-23 13:10:48 +02:00
filetree Remove redundant variable dedeclarations 2024-05-19 16:38:21 +10:00
keybindings Add range selection ability on list contexts 2024-01-19 10:47:21 +11:00
mergeconflicts Remove redundant variable dedeclarations 2024-05-19 16:38:21 +10:00
modes rename sha to hash 5 2024-04-12 08:33:47 +02:00
patch_exploring Remove redundant variable dedeclarations 2024-05-19 16:38:21 +10:00
popup Allow editing a custom command from the suggestions list by pressing 'e' 2024-05-19 07:06:18 +02:00
presentation Use utils.StringWidth to optimize rendering performance 2024-06-23 13:10:48 +02:00
services/custom_commands Add property outputTitle to CustomCommand 2024-05-20 21:02:49 +02:00
status Clean up error handling of WithWaitingStatus and WithWaitingStatusSync 2024-04-18 10:10:30 +02:00
style Remove redundant variable dedeclarations 2024-05-19 16:38:21 +10:00
types Rerender fewer views when their width changes 2024-06-23 13:10:48 +02:00
background.go Log memory usage every 10s 2024-06-23 11:48:40 +02:00
command_log_panel.go Introduce filtered list view model 2023-07-03 12:54:13 +10:00
context.go Show mode-specific keybinding suggestions 2024-01-28 08:33:13 +11:00
context_config.go move some methods 2023-04-30 13:19:53 +10:00
controllers.go Clear keybinding functions in resetHelpersAndControllers 2024-06-23 12:28:42 +02:00
dummies.go pkg: fix some comment 2024-04-07 16:09:26 +08:00
editors.go Add emacs-keybinds for word navigation 2023-08-15 12:22:17 +02:00
extras_panel.go Extract a SaveAppStateAndLogError function 2023-09-04 17:50:49 +02:00
global_handlers.go Remove calls to Error() 2024-04-18 10:10:30 +02:00
gui.go Clear highlight in HandleFocusLost 2024-06-23 13:21:49 +02:00
gui_common.go Run PTY tasks after layout so that they get the correct view size 2024-06-23 12:36:40 +02:00
gui_driver.go Don't wait in integration tests when running in headless mode 2024-06-05 14:44:02 +02:00
information_panel.go Use utils.StringWidth to optimize rendering performance 2024-06-23 13:10:48 +02:00
keybindings.go Remove ErrorMsg 2024-04-18 10:10:30 +02:00
layout.go Clear highlight in HandleFocusLost 2024-06-23 13:21:49 +02:00
main_panels.go Run PTY tasks after layout so that they get the correct view size 2024-06-23 12:36:40 +02:00
menu_panel.go Add menu prompt 2024-06-23 12:33:16 +02:00
options_map.go Show mode-specific keybinding suggestions 2024-01-28 08:33:13 +11:00
pty.go Fix possible off-by-one error wrt PTY size 2024-06-23 12:36:40 +02:00
pty_windows.go Format code to pass lint 2021-09-16 21:38:43 +08:00
recent_repos_panel.go Use forward-slashes on windows 2023-07-30 18:35:24 +10:00
tasks_adapter.go Use an interface for tasks instead of a concrete struct 2023-07-10 17:12:21 +10:00
test_mode.go Don't wait in integration tests when running in headless mode 2024-06-05 14:44:02 +02:00
view_helpers.go Make HandleGenericClick a little smarter 2024-03-29 10:55:33 +01:00
views.go Add config for soft-wrapping the commit message body 2024-03-09 10:00:44 +01:00