summaryrefslogtreecommitdiffstats
path: root/pkg/gui/gui.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-06-03Factor out CommitLoader.mainBranches into its own class, and store it in ModelStefan Haller
2024-05-29Fix out-of-date commentStefan Haller
The behavior described in the comment is no longer what we do, it was changed in ae66f720f5; we now always reuse the state.
2024-05-05Fix deadlock reportingfix-deadlock-reportingStefan Haller
Deadlock reporting broke in e1ceb6892a; since then, it was *off* when running debug builds normally, but *on* when debugging an integration test. Both of which are exactly opposite of what we want.
2024-04-18Rename Error() to ErrorHandler()Stefan Haller
It is now only used as the error handler that is passed to gocui.Gui on construction; it's not a client-facing API any more. Also, it doesn't have to handle gocui.ErrQuit, as gocui takes care of that.
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-04-18Clean up error handling of WithWaitingStatus and WithWaitingStatusSyncStefan Haller
2024-04-18Remove calls to Error()Stefan Haller
Now that we have an error handler set, we can simply let them bubble up all the way to gocui.
2024-04-18Set ErrorHandlerStefan Haller
2024-04-18Bump gocuiStefan Haller
In Gui.onWorker we only make the minimum possible change to get things to compile after the API-breaking change of the gocui update; we'll make this cleaner later in this branch.
2024-04-09Fix stderr redirectionEmanuele "Lele" Calo
Seems that there's a problem in the Stdout/Stderr/Stdin vars assignments, probably copy-paste issue.
2024-04-07pkg: fix some commenthongkuang
Signed-off-by: hongkuang <liurenhong@outlook.com>
2024-03-21Always prompt to return from subprocess if there was an errorstk
Except when we are running integration tests, in which case we never want to prompt because there wouldn't be a way to confirm the prompt.
2024-03-12Show popup message with breaking changes on startupStefan Haller
2024-02-21Add author filtering to commit viewTristan Déplantes
This commit introduces a new feature to the commit view, allowing users to filter commits based on the author's name or email address. Similar to the existing path filtering functionality, accessible through <c-s>, this feature allows users to filter the commit history by the currently selected commit's author if the commit view is focused, or by typing in the author's name or email address. This feature adds an entry to the filtering menu, to provide users with a familiar and intuitive experience
2024-01-19Add SetSelection function for list contexts and use it in most placesJesse Duffield
The only time we should call SetSelectedLineIdx is when we are happy for a select range to be retained which means things like moving the selected line index to top top/bottom or up/down a page as the user navigates. But in every other case we should now call SetSelection because that will set the selected index and cancel the range which is almost always what we want.
2024-01-14Add ErrorToast functionStefan Haller
2024-01-14Make it possible to handle toasts in integration testsStefan Haller
Use it in two selected tests to demonstrate what it looks like.
2023-12-09Add WithWaitingStatusSyncStefan Haller
2023-10-08Remove sync mutexStefan Haller
I'm pretty convinced we don't need it. Git itself does a good job of making sure that concurrent operations don't corrupt anything.
2023-10-08Add GetItemOperation/SetItemOperation/ClearItemOperation to IStateAccessorStefan Haller
Not used by anything yet; committing this separately in the interest of having smaller independent commits.
2023-09-28Disable deadlock reporting when debugging an integration testStefan Haller
2023-09-20Remove unused WithLoaderPanel codeStefan Haller
2023-08-02Remove file watcher codeJesse Duffield
Now that we refresh upon focus, we can scrap this file watching code. Stefan says few git UIs use file watching, and I understand why: the reason this code was problematic in the first place is that watching files is expensive and if you have too many open file handles that can cause problems. Importantly: this code that's being removed was _already_ dead.
2023-08-02Refresh when the terminal window gets the focusStefan Haller
2023-08-01Start in fullscreen when passing a git argJesse Duffield
Often we just want to see the desired view in fullscreen so I'm making that the default
2023-07-31Add automated demo recordings (#2853)Jesse Duffield
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-31Move IgnoreWhitespaceInDiffView to AppState, and persist it when it changesStefan Haller
2023-07-31Add a "Mark commit as base commit for rebase" commandStefan Haller
This allows to do the equivalent of "git rebase --onto <target> <base>", by first marking the <base> commit with the new command, and then selecting the target branch and invoking the usual rebase command there.
2023-07-30Use fields rather than methods on worktreesJesse Duffield
I would prefer to use methods to keep things immutable but I'd rather be consistent with the other models and update them all at once
2023-07-30Centralise logic for obtaining repo pathsJesse Duffield
There are quite a few paths you might want to get e.g. the repo's path, the worktree's path, the repo's git dir path, the worktree's git dir path. I want these all obtained once and then used when needed rather than having to have IO whenever we need them. This is not so much about reducing time spent on IO as it is about not having to care about errors every time we want a path.
2023-07-30Update repo switch logicJesse Duffield
We now always re-use the state of the repo if we're returning to it, and we always reset the windows to their default tabs. We reset to default tabs because it's easy to implement. If people want to: * have tab states be retained when switching * have tab states specific to the current repo retained when switching back Then we'll need to revisit this
2023-07-30Remove worktree version guardsJesse Duffield
Our min required git version is 2.20 so there's no need to add guards for worktrees because they were added in 2.5
2023-07-30Move worktrees tab to files windowJesse Duffield
2023-07-30Hide worktree functionality on old git versionsJesse Duffield
2023-07-30Land in the same panel when switching to a worktreeJesse Duffield
2023-07-30Initial addition of support for worktreesJoel Baranick
2023-07-22Keep track of authors across local commits and branch commits for suggestionsJesse Duffield
Previously, we would only show the authors based on local commits, but sometimes you want to set a commit author to that of a commit on another branch. Now, so long as you've viewed the branch's commits, the author will appear as a suggestion.
2023-07-19Add integration test for accordion modeJesse 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-10Fix flakey misc/initial_open testJesse Duffield
I've simplifiied the code because it was too complex for the current requirements, and this fixed the misc/initial_open test which was occasionally failing due to a race condition around busy tasks
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-09Add mutex for refreshing branchesJesse Duffield
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-08Wait for intro before doing any of our refresh functionsJesse Duffield
We were doing this already for fetching but not for refreshing files so I'm making it consistent.
2023-07-08Handle pending actions properly in git commands that require credentialsJesse Duffield
I don't know if this is a hack or not: we run a git command and increment the pending action count to 1 but at some point the command requests a username or password, so we need to prompt the user to enter that. At that point we don't want to say that there is a pending action, so we decrement the action count before prompting the user and then re-increment it again afterward. Given that we panic when the counter goes below zero, it's important that it's not zero when we run the git command (should be impossible anyway). I toyed with a different approach using channels and a long-running goroutine that handles all commands that request credentials but it feels over-engineered compared to this commit's approach.
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-06-15Add nerdFontsVersion configStefan Haller