summaryrefslogtreecommitdiffstats
path: root/pkg/gui/gui_common.go
AgeCommit message (Collapse)Author
2024-06-23Run PTY tasks after layout so that they get the correct view sizeStefan Haller
This is important when using a pager that draws a horizontal line across the entire width of the view; when changing from a file or directory that has only unstaged (or only staged) changes to one that has both, the main view is split in half, but the PTY task would be run on the view in its old state, so the horizonal line would be too long and wrap around.
2024-04-18Make OnWorker callback return an errorStefan Haller
This lets us get rid of a few more calls to Error(), and it simplifies things for clients of OnWorker: they can simply return an error from their callback like we do everywhere else.
2024-03-29Extract a function HandleGenericClickStefan Haller
2023-10-08Add WithInlineStatus helper functionStefan Haller
Very similar to WithWaitingStatus, except that the status is shown in a view next to the affected item, rather than in the status bar. Not used by anything yet; again, committing separately to get smaller commits.
2023-09-18Add Enabled func to BindingStefan Haller
2023-09-04Extract a SaveAppStateAndLogError functionStefan Haller
It seems that most actions that change a state option and resave the state want to just log the error.
2023-08-30Don't show toasts when running integration testsStefan Haller
It's pointless because you can't check for them in tests anyway, so they unnecessarily slow down the test run by two seconds for no reason.
2023-07-31Add demo test variantJesse Duffield
We're piggybacking on our existing integration test framework to record demos that we can include in our docs
2023-07-30Land in the same panel when switching to a worktreeJesse Duffield
2023-07-19Properly fix accordion issueJesse Duffield
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-10Use an interface for tasks instead of a concrete structJesse Duffield
By using an interface for tasks we can use a fake implementation in tests with extra methods
2023-07-09Use first class task objects instead of global counterJesse Duffield
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-08Add busy count for integration testsJesse Duffield
Integration tests need to be notified when Lazygit is idle so they can progress to the next assertion / user action.
2023-07-03Introduce filtered list view modelJesse Duffield
We're going to start supporting filtering of list views
2023-05-11remove duplicate methodJesse Duffield
2023-05-11Merge branch 'master' into refactor-better-encapsulationJesse Duffield
2023-05-02merge master into refactor-better-encapsulationJesse Duffield
2023-05-01Merge pull request #2551 from stefanhaller/fix-initial-context-activationv0.38.0Jesse Duffield
2023-04-30Split commit message panel into commit summary and commit description panelSean
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-30remove unused fileJesse Duffield
2023-04-30move another action into controllerJesse Duffield
2023-04-30lots of changesJesse Duffield
2023-04-30lots more refactoringJesse Duffield
2023-04-30Begin refactoring guiJesse Duffield
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-30Split commit message panel into commit summary and commit description panelSean
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-29Fix activation of initial contextStefan Haller
This broke with 40f6767cfc77; the symptom is that starting lazygit with a git arg (e.g. "lazygit log") wouldn't activate the requested panel correctly. While it would show in the expanded view, it didn't have a green frame, and keyboard events would go to the files panel.
2022-08-07allow rendering to main panels from anywhereJesse Duffield
2022-08-07move merge conflicts code into controllerJesse Duffield
2022-08-06refactor to only have one context per viewJesse Duffield
2022-08-01fix issue caused by opening a menu over a promptJesse Duffield
2022-03-17refactor credential handlingJesse Duffield
2022-03-17add commit message controllerJesse Duffield
2022-03-17refactor contexts codeJesse Duffield
2022-03-17start moving commit panel handlers into controllerJesse Duffield
more and more move rebase commit refreshing into existing abstraction and more and more WIP and more handling clicks properly fix merge conflicts update cheatsheet lots more preparation to start moving things into controllers WIP better typing expand on remotes controller moving more code into controllers