1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-30 09:16:47 +02:00
Commit Graph

64 Commits

Author SHA1 Message Date
Jesse Duffield
a5ee61c117 Properly fix accordion issue
The true issue was that we were focusing the line in the view before it gets resized in the layout function.
This meant if the view was squashed in accordion mode, the view wouldn't know how to set the cursor/origin to
focus the line.

Now we've got a queue of 'after layout' functions i.e. functions to call at the end of the layout function,
right before views are drawn.

The only caveat is that we can't have an infinite buffer so we're arbitrarily capping it at 1000 and dropping
functions if we exceed that limit. But that really should never happen.
2023-07-19 21:16:27 +10:00
Jesse Duffield
6b9390409e Use an interface for tasks instead of a concrete struct
By using an interface for tasks we can use a fake implementation in tests with extra methods
2023-07-10 17:12:21 +10:00
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
Jesse Duffield
9e79ee5fe3 Add dev doc for busy/idle tracking 2023-07-09 20:57:18 +10:00
Jesse Duffield
e588355f57 Add mutex for refreshing branches
We had a race condition due to refreshing branches in two different places, one which refreshed reflog commits
beforehand. The race condition meant that upon load we wouldn't see recency values (provided by the reflog commits)
against the branches
2023-07-09 20:57:18 +10:00
Jesse Duffield
6c4e7ee972 Add busy count for integration tests
Integration tests need to be notified when Lazygit is idle so they can progress to the next assertion / user action.
2023-07-08 22:54:52 +10:00
Jesse Duffield
b8bee4de51 Scroll to top when filtering and retain selection when cancelling filter 2023-07-03 12:54:14 +10:00
Jesse Duffield
84870d4503 Cancel filter/search when hitting escape 2023-07-03 12:54:13 +10:00
Jesse Duffield
a9e2c8129f Introduce filtered list view model
We're going to start supporting filtering of list views
2023-07-03 12:54:13 +10:00
Stefan Haller
64b2685c2d Visualize the "ignore whitespace" state in the subtitle of the diff view 2023-05-20 12:58:32 +10:00
Jesse Duffield
5dacbb6293 merge master into refactor-better-encapsulation 2023-05-02 19:05:42 +10:00
Sean
9d68b287db Split commit message panel into commit summary and commit description panel
When we use the one panel for the entire commit message, its tricky to have a keybinding both for adding a newline and submitting.
By having two panels: one for the summary line and one for the description, we allow for 'enter' to submit the message when done from the summary panel,
and 'enter' to add a newline when done from the description panel. Alt-enter, for those who can use that key combo, also works for submitting the message
from the description panel. For those who can't use that key combo, and don't want to remap the keybinding, they can hit tab to go back to the summary panel
and then 'enter' to submit the message.

We have some awkwardness in that both contexts (i.e. panels) need to appear and disappear in tandem and we don't have a great way of handling that concept,
so we just push both contexts one after the other, and likewise remove both contexts when we escape.
2023-04-30 13:19:53 +10:00
Jesse Duffield
037cd99138 move quit actions to controller 2023-04-30 13:19:53 +10:00
Jesse Duffield
2cba98e3fe move another action into controller 2023-04-30 13:19:53 +10:00
Jesse Duffield
f8c9ce33c2 move more actions into controller 2023-04-30 13:19:53 +10:00
Jesse Duffield
db12853bbe lots of changes 2023-04-30 13:19:53 +10:00
Jesse Duffield
43251e7275 split context common from helper common 2023-04-30 13:19:53 +10:00
Jesse Duffield
1b2fb34ffd start moving getDisplayStrings funcs into contexts 2023-04-30 13:19:53 +10:00
Jesse Duffield
509e3efa70 lots more refactoring 2023-04-30 13:19:53 +10:00
Jesse Duffield
8edad826ca Begin refactoring gui
This begins a big refactor of moving more code out of the Gui struct into contexts, controllers, and helpers. We also move some code into structs in the
gui package purely for the sake of better encapsulation
2023-04-30 13:19:52 +10:00
Jesse Duffield
c36333af3d
Merge pull request #2433 from Ryooooooga/subcommits-limit 2023-03-06 18:22:57 +11:00
Stefan Haller
de3e4838ad Store WorkingTreeState in model
This is the working tree state at the time the model commits were loaded. This
avoids a visual glitch with the "You Are Here" label appearing at times when it
is not supposed to.
2023-03-01 09:12:00 +01:00
Ryooooooga
a624e0457f
feat(subcommits): load unlimited sub-commits 2023-02-27 15:29:00 +09:00
Jesse Duffield
ba96baee32 move code from main into app package to allow test to be injected 2022-08-13 13:55:08 +10:00
Jesse Duffield
d890238c7b move input and assert into integration tests package 2022-08-13 13:52:13 +10:00
Jesse Duffield
d73a236d7c allow rendering to main panels from anywhere 2022-08-07 12:05:51 +10:00
Jesse Duffield
755ae0ef84 add deadlock mutex package
write to deadlock stderr after closing gocui

more deadlock checking
2022-08-07 11:16:14 +10:00
Jesse Duffield
7410acd1aa move merge conflicts code into controller 2022-08-07 11:16:03 +10:00
Jesse Duffield
524bf83a4a refactor to only have one context per view 2022-08-06 13:49:11 +10:00
Jesse Duffield
debc58b6c5 fix popup focus issue 2022-08-01 22:09:48 +10:00
Jesse Duffield
fab2e14b55 fix issue caused by opening a menu over a prompt 2022-08-01 21:38:57 +10:00
Jesse Duffield
7077ea428f add optimistic rendering for staging and unstaging files 2022-07-31 14:34:57 +10:00
Luka Markušić
1f482e585e Fix github linter errors 2022-07-30 08:10:29 +02:00
Jesse Duffield
b1e4968d0b allow opening lazygit to a specific panel 2022-06-11 11:23:56 +10:00
Ryooooooga
61970a4439
fix: fix ambiguous refname 2022-05-13 21:05:51 +09:00
Jesse Duffield
6f8063217d rename displayString to label for menu items 2022-05-08 14:26:18 +10:00
Jesse Duffield
f257740ea7 add tooltip view for showing menu item descriptions 2022-05-08 13:24:36 +10:00
Jesse Duffield
e68093fe99 add scrollbars 2022-04-16 17:29:17 +10:00
Ryooooooga
4835fc00b8 introduce Ref interface 2022-04-02 17:04:42 +11:00
Moritz Haase
8fb2acc224 pkg/gui: Rename IPopupHandler::Ask() to Confirm()
Follow the JavaScript naming scheme for user interaction (alert, prompt,
confirm) as discussed in #1832.
2022-03-30 20:13:43 +11:00
Moritz Haase
9bccc20888 pkg/gui: Add support for 'notification' popups
Add a new 'Notification()' method to 'IPopupHandler' that makes it easier to
show a modal info message to the user. This is simply a convenience wrapper
around 'Ask()', so the popup can be closed using both 'Enter' and 'ESC'.
2022-03-28 09:13:34 +11:00
Jesse Duffield
9c226eed37 allow menu to store keybindings for quick menu navigation 2022-03-27 18:16:16 +11:00
Jesse Duffield
98e7ec0905 add type alias for Key 2022-03-27 18:16:16 +11:00
Jesse Duffield
fe87114074 don't hide transient views upon losing focus 2022-03-26 18:00:46 +11:00
Jesse Duffield
13b90ac37f support viewing commits of reflog entry and show better view title 2022-03-26 18:00:46 +11:00
Jesse Duffield
a34bdf1a04 update linters 2022-03-19 12:12:57 +11:00
Jesse Duffield
d93fef4c61 use generics to DRY up context code 2022-03-19 12:12:57 +11:00
Jesse Duffield
59d4df2a44 fix click handling 2022-03-17 19:13:40 +11:00
Jesse Duffield
46e9946854 refactor credential handling 2022-03-17 19:13:40 +11:00
Jesse Duffield
d991d74b06 add commit message controller 2022-03-17 19:13:40 +11:00