jesseduffield.lazygit/pkg/gui/types
Jesse Duffield 14ecc15e71 Use first class task objects instead of global counter
The global counter approach is easy to understand but it's brittle and depends on implicit behaviour that is not very discoverable.

With a global counter, if any goroutine accidentally decrements the counter twice, we'll think lazygit is idle when it's actually busy.
Likewise if a goroutine accidentally increments the counter twice we'll think lazygit is busy when it's actually idle.
With the new approach we have a map of tasks where each task can either be busy or not. We create a new task and add it to the map
when we spawn a worker goroutine (among other things) and we remove it once the task is done.

The task can also be paused and continued for situations where we switch back and forth between running a program and asking for user
input.

In order for this to work with `git push` (and other commands that require credentials) we need to obtain the task from gocui when
we create the worker goroutine, and then pass it along to the commands package to pause/continue the task as required. This is
MUCH more discoverable than the old approach which just decremented and incremented the global counter from within the commands package,
but it's at the cost of expanding some function signatures (arguably a good thing).

Likewise, whenever you want to call WithWaitingStatus or WithLoaderPanel the callback will now have access to the task for pausing/
continuing. We only need to actually make use of this functionality in a couple of places so it's a high price to pay, but I don't
know if I want to introduce a WithWaitingStatusTask and WithLoaderPanelTask function (open to suggestions).
2023-07-09 21:30:19 +10:00
..
common.go Use first class task objects instead of global counter 2023-07-09 21:30:19 +10:00
common_commands.go start moving commit panel handlers into controller 2022-03-17 19:13:40 +11:00
context.go Scroll to top when filtering and retain selection when cancelling filter 2023-07-03 12:54:14 +10:00
keybindings.go lots more refactoring 2023-04-30 13:19:53 +10:00
modes.go controller for viewing sub commits 2022-03-17 19:13:40 +11:00
ref.go fix: fix ambiguous refname 2022-05-13 21:05:51 +09:00
refresh.go Begin refactoring gui 2023-04-30 13:19:52 +10:00
rendering.go Visualize the "ignore whitespace" state in the subtitle of the diff view 2023-05-20 12:58:32 +10:00
search_state.go Introduce filtered list view model 2023-07-03 12:54:13 +10:00
suggestion.go support labels for suggestions which are distinct from values 2020-11-28 20:48:17 +11:00
views.go Split commit message panel into commit summary and commit description panel 2023-04-30 13:19:53 +10:00