summaryrefslogtreecommitdiffstats
path: root/pkg/gui
AgeCommit message (Collapse)Author
2024-06-12Show "exec" todos in the list of rebase todosStefan Haller
Unfortunately it isn't possible to delete them. This would often be useful, but our todo rewriting mechanisms rely on being able to find todos by some identifier (hash for pick, ref for update-ref), and exec todos don't have a unique identifier.
2024-06-10Disregard master commits when finding base commit for fixupStefan Haller
If exactly one candidate from inside the current branch is found, we return that one even if there are also hunks belonging to master commits; we disregard those in this case.
2024-06-10Don't reference Model().Commits multiple timesStefan Haller
Copy the slice into a variable and use that throughout the whole operation; this makes us a little more robust against the model refreshing concurrently.
2024-06-07feat: support range selection for commit attributes amendAzraelSec
2024-06-07feat: let the staging secondary panel change view modeAzraelSec
2024-06-05Don't wait in integration tests when running in headless modeStefan Haller
There's no point in spending time waiting in this case, as nobody can see it.
2024-06-03Add command "Rebase onto base branch" to rebase menuStefan Haller
2024-06-03Remove target branch from title of rebase menuStefan Haller
Put it into the individual menu items instead. Again, this is necessary because we are going to add another entry to the menu that is independent of the selected branch.
2024-06-03Always show rebase menu, even when rebasing is not possibleStefan Haller
Instead, disable the individual entries in the menu. This is necessary because we are going to add another entry to the menu that is independent of the selected branch.
2024-06-03Make "Rebase" show up with "..." in the keybindings menuStefan Haller
2024-06-03Add command "View divergence from base branch"Stefan Haller
2024-06-03Show divergence from base branch in branches listStefan Haller
2024-06-03Remove ColoredBranchStatus and branchStatusColorStefan Haller
Previously the entire status was colored in a single color, so the API made sense. This is going to change in the next commit, so now we must include the color in the string returned from BranchStatus(), which means that callers who need to do hit detection or measure the length need to decolorize it. While we're at it, switch the order of ↑3↓7 to ↓7↑3. For some reason that I can't really explain I find it more logical this way. The software out there is pretty undecided about it, it seems: VS Code puts ↓7 first, and so does the shell prompt that comes with git; git status and git branch -v put "ahead" first though. Shrug.
2024-06-03Factor out CommitLoader.mainBranches into its own class, and store it in ModelStefan Haller
2024-06-03More explicit test of status panel contentStefan Haller
Use Equals instead of Contains for asserting the status view content. This solves the problem that we might assert Contains("↓2 repo"), but what it really shows is "↑1↓2 repo", and the test still succeeds. At best this is confusing. Also, this way we don't have to use the awkward DoesNotContain to check that it really doesn't show a checkmark. To do this, we need to fix two whitespace problems: - there was always a space at the end for no reason. Simply remove it. It was added in efb51eee96, but from looking at that diff it seems it was added accidentally. - there was a space at the beginning if the branch status was empty. This is actually a cosmetic problem, for branches without a status the text was indented by once space. Change this so that the space is added conditionally. It's a bit awkward that we have to use Decolorise here, but this will go away again later in this branch.
2024-06-01Make "Find base commit for fixup" work with hunks with only added linesStefan Haller
To understand what this does and why, read the design document that I'm about to add in the next commit.
2024-06-01Extract a function findCommitStefan Haller
It's not much code, but it turns three lines of code into one, and since we need to do this a few more times in the next commit, it's worth it.
2024-06-01Return errors from blameDeletedLines instead of just logging themStefan Haller
I guess when I originally wrote this code I just didn't know how to do that...
2024-06-01Also return hunks with only added lines from parseDiffStefan Haller
We aren't using them, yet, except for deciding whether to show the warning about hunks with only added lines. Add a bit of test coverage for parseDiff while we're at it.
2024-06-01Make parseDiff a non-member function so that we can test it more easilyStefan Haller
2024-06-01Rename deletedLineInfo to hunkStefan Haller
We'll use it with a more general meaning later in this branch.
2024-06-01Add user config `expandedSidePanelWeight`Stefan Haller
2024-06-01Add test for ExpandFocusedSidePanel configStefan Haller
2024-06-01Use --force instead of --force-with-lease when remote is not stored locallyStefan Haller
--force-with-lease simply doesn't work in this case, it will always return a "stale info" error.
2024-06-01Rename Force to ForceWithLeaseStefan Haller
This describes better what it is, and we're going to add the regular --force in the next commit. No change in behavior in this commit.
2024-06-01Ask to force push if server rejected the update, if remote not stored locallyStefan Haller
This broke with 81b497d186 (#3387). In that PR I claimed that we never want to ask for force-pushing if the server rejected the update, on the assumption that this can only happen because the remote tracking branch is not up to date, and users should just fetch in this case. However, I didn't realize it's even possible to have a branch whose upstream branch is not stored locally; in this case we can't tell ahead of time whether a force push is going to be necessary, so we _have_ to rely on the server response to find out. But we only want to do that in this specific case, so this is not quite an exact revert of 81b497d186.
2024-05-29Refresh branches and reflog independently when sorting branches by dateStefan Haller
When branches are sorted by recency we have this logic that first loads the branches so that they can be rendered quickly; in parallel, it starts loading the reflog in the background, and when that's done, it loads the branches again so that they get their recency values. This means that branches are loaded twice at startup. We don't need this logic when branches are not sorted by recency, so we can simply load branches and reflog in parallel like everything else. This shouldn't change any user observable behavior, it just avoids doing unnecessary work at startup.
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-26Fix calculation of tooltip heightStefan Haller
For tooltips that are just one or two characters longer than the available width, the last word would be cut off. On my screen this happened for the tooltip for the fixup command.
2024-05-20Add property outputTitle to CustomCommandStefan Haller
It can optionally be used to set the title of the panel that shows the output of a command (when showOutput is true). If left unset, the command string is used as the title.
2024-05-20feat: focus on local commits view after moving code into new commitAzraelSec
2024-05-19Correctly request force-pushing in triangular workflowsStefan Haller
To determine whether we need to ask for force pushing, we need to query the push branch rather than the upstream branch, in case they are not the same.
2024-05-19Add ahead/behind information for @{push}Stefan Haller
In a triangular workflow the branch that you're pulling from is not the same as the one that you are pushing to. For example, some people find it useful to set the upstream branch to origin/master so that pulling effectively rebases onto master, and set the push.default git config to "current" so that "feature" pushes to origin/feature. Another example is a fork-based workflow where "feature" has upstream set to upstream/main, and the repo has remote.pushDefault set to "origin", so pushing on "feature" pushes to origin/feature. This commit adds new fields to models.Branch that store the ahead/behind information against the push branch; for the "normal" workflow where you pull and push from/to the upstream branch, AheadForPush/BehindForPush will be the same as AheadForPull/BehindForPull.
2024-05-19Rename Pushables/Pullables to AheadForPull/BehindForPullStefan Haller
In preparation for adding AheadForPush/BehindForPush in the next commit.
2024-05-19Create shims for all model classes in SessionStateLoaderStefan Haller
This guards against accidentally renaming a model field and thereby breaking user's custom commands. With this change we'll get a build failure when we do that.
2024-05-19Remove redundant variable dedeclarationsJesse Duffield
In go 1.22, loop variables are redeclared with each iteration of the loop, rather than simple updated on each iteration. This means that we no longer need to manually redeclare variables when they're closed over by a function.
2024-05-19Show delete/edit keybindings in suggestions subtitle if availableStefan Haller
2024-05-19Allow editing a custom command from the suggestions list by pressing 'e'Stefan Haller
For custom commands it is useful to select an earlier command and have it copied to the prompt for further editing. This can be done by hitting 'e' now. For other types of suggestion panels we don't enable this behavior, as you can't create arbitrary new items there that don't already exist as a suggestion.
2024-05-19Support deleting items from the custom commands historyStefan Haller
In the custom commands panel you can now tab to the suggestions and hit 'd' to delete items from there. Useful if you mistyped a command and don't want it to appear in your history any more.
2024-05-15Use ScanLinesAndTruncateWhenLongerThanBuffer instead of bufio.ScanLinesStefan Haller
2024-05-15Fix clicking in status side panelStefan Haller
Seems to have been broken since that big refactoring in March 23.
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-05-01Add commitPrefix for defining a prefix for any projectJonathan Duck
2024-04-30Enable the commit graph in the divergence viewStefan Haller
2024-04-28chore: fix some comments and typosknowmost
Signed-off-by: knowmost <knowmost@outlook.com>
2024-04-27Refactor `pkg/gui/presentation/commits.go` slightly to be consistentStefan Haller
Change `func displayCommit()` so all the individual strings are built first, then the whole thing `cols` is put together. Before, most strings were built prior to constructing `cols`, but a few were built inside the `cols` construction.
2024-04-27Add config option for length of commit hash displayed in commits viewOlivia Bahr
- Add config option `commitHashLength` to to pkg/config/user_config.go - Changed the hash display in pkg/gui/presentation/commits.go
2024-04-22Switch git-todo-parser from fsmiamoto original repo to stefanhaller's forkStefan Haller
Sometimes it takes a while to get PRs accepted upstream, and this blocks our progress. Since I'm pretty much the only one making changes there anyway, it makes sense to point to my fork directly.
2024-04-18Remove ErrorMsgStefan Haller
There is no reason any more for application code to show error messages in a panel. Just return an error instead.
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.