summaryrefslogtreecommitdiffstats
path: root/pkg/gui
AgeCommit message (Collapse)Author
2024-03-11Internationalize the tooltips of the "Amend commit attributes" menuAbhishek Keshri
2024-03-09Remove hard line breaks when rewording commitsStefan Haller
... and when recalling a commit message from an old commit by pressing up-arrow. This is necessary because committing turns our soft line breaks into real ones, but when rewording we want to turn them back into soft ones again, so that it's possible to insert words at the beginning of a paragraph and have everything rewrap nicely. This is only a best effort; the algorithm only removes those hard line breaks that can be removed without changing the way the message looks. This works well when the previous commit message was wrapped at the same width, which for most users should be the most common case; but if it wasn't, the result is not great. Specifically, if the old wrap width was smaller, some hard line breaks just won't be removed; if it was wider though, you'll get an unpleasant comb effect with alternating long and short lines. In such a case it's best to switch to the editor and use whatever wrapping features you have there (e.g. alt-Q).
2024-03-09Save and restore the unwrapped descriptionStefan Haller
When preserving the commit message (when cancelling a commit), and later restoring it, use the unwrapped description.
2024-03-09Add config for soft-wrapping the commit message bodyStefan Haller
2024-03-09Keep the same line selected after squashing fixup commitsStefan Haller
This uses a bit of a heuristic that is hopefully correct most of the time.
2024-03-09Extract common code to a helper methodStefan Haller
This should arguably have been done in b133318b40 already; it's becoming more important now because we're going to extend the common code with more logic in the next commit.
2024-03-09Move selection down by one after creating a fixup commitStefan Haller
2024-03-09Support setting a range of commits to "edit" outside of a rebaseStefan Haller
It starts a rebase on the bottom-most commit of the range, and sets all the selected commits to "edit" (skipping merge commits, because they can't be edited).
2024-03-07Show all submodules recursivelyStefan Haller
2024-03-07Pass entire submodule to UpdateUrl instead of name and path separatelyStefan Haller
This will make the next commit slightly simpler.
2024-03-06Don't strike out reserved keys in menusStefan Haller
It seems to cause more confusion than it helps.
2024-03-02Don't show branch head on rebase todos if the rebase.updateRefs config is onStefan Haller
The additional branch head icon is more confusing than useful in this situation. The update-ref entries show very clearly where the branch heads will go when continuing the rebase; the information where the branch heads used to be before the rebase is not really needed here, and just makes the display more confusing. I'm not adding more tests here because the changes to the existing tests demonstrate the change clearly enough.
2024-03-02Rename showBranchMarkerForHeadCommit parameter to hasRebaseUpdateRefsConfigStefan Haller
Name it after what it is rather than what it is used for. In the next commit we will use it for another condition.
2024-03-02Make ctrl-f available in staging viewStefan Haller
A common workflow for me is to create a fixup commit from only some of my current changes; to do that, I enter a file, stage a few hunks, and then want to invoke ctrl-f to find the base commit for these changes. Currently I need to esc back to the files panel in order to do that; it's more convenient to be able to do this right from the staging panel.
2024-03-02Fix linter warningsStefan Haller
These started to pop up in my editor after I installed an update of gopls, I think. It's unfortunate that we don't see them on CI.
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-02-21Add tooltips for reset menu itemsStefan Haller
2024-02-21Change "git reset" default to --mixedStefan Haller
Calling "git reset" on the command line (without further arguments) defaults to --mixed, which is reason enough to make it the default for us, too. But I also find myself using --mixed more often than --soft. The main use case for me is that I made a bunch of WIP commits, and want to turn them into real commits when I'm done hacking. I select the last commit before the WIP commits and reset to it, leaving all changes of all those commits in the working directory. Since I want to start staging things from there, I prefer those modifications to be unstaged at that point, which is what --mixed does.
2024-02-16Don't omit section headers when filtering the keybindings menuStefan Haller
2024-02-16Optionally keep sort order stable when filtering listsStefan Haller
For some lists it is useful to keep the same sort order when filtering (rather than sorting by best match like we usually do). Add an optional function to FilteredList to make this possible, and use it whenever we show lists of things sorted by date (branches, stashes, reflog entries), as well as menu items because this allows us to keep the section headers in the keybindings menu, which is useful for understanding what you are looking at when filtering.
2024-02-16Fix number of lines to read from a task initially for the right scroll bar sizeStefan Haller
After #3283 we need to read more lines initially so that the scrollbar goes to its minimal height of 1 for long diffs. Without this, it would start with a height of 2 and then become smaller after you scroll down half the window height.
2024-02-16Fix order problems when saving custom commands historyStefan Haller
This fixes two problems: - each time the custom commands panel was opened, the history of commands would be shown in reversed order compared to last time. (The reason is that lo.Reverse modifies the slice in place rather than just returning a new, reversed slice.) - when executing a previous command again (either by typing it in again, or by picking it from the history), it should move to the beginning of the history, but didn't. We fix this by storing the history in reversed order (as the user sees it in the panel), this makes the logic simpler. We just have to prepend rather than append newly added commands now. While this is theoretically a breaking change, it's not worth bothering because the order was wrong for existing users in 50% of the cases anyway.
2024-02-16Simplify saving app stateStefan Haller
2024-02-16Redraw commits view when showGraph setting changesStefan Haller
2024-02-16Deprecate git.log.showGraph and git.log.order configAlex March
Added identical properties to AppState that should eventually have their defaults set.
2024-02-16Avoid crash when hitting enter on an update-ref todoStefan Haller
2024-02-16Fix a problem with refreshing while an update-ref todo is selectedStefan Haller
Scenario: - show the files of a commit, escape out of it again - start an interactive rebase of a stack of branches, with the rebase.updateRefs git config set to true - select one of the update-ref todos - trigger a refresh (either manually or by bringing lazygit's terminal window to the front) This results in an error message "fatal: ambiguous argument '': unknown revision or path not in the working tree." Fix this by putting another band-aid on the check for the commit files refresh. This is the easiest way to fix the problem, but I don't think it's the best one. We shouldn't be refreshing the commit files context at all if it isn't visible, because it's pointless; there's no way to switch to it again except by calling viewFiles again with a specific ref. But I'm too lazy too figure out how to do that right now.
2024-02-13Fix range select bugAaron Hoffman
After discarding file changes from the commit, the was still referencing these indexes as being part of the range select. The consequence was needing to hit escape twice to exit commit files in some situations. Canceling the range select after discarding changes fixes that.
2024-02-13CleanupAaron Hoffman
The waiting status shouldn't happen until after the user has responded to the popup. Since we're not giving a standalone prompt about clearing the patch, all of the business in `discard` doesn't need to be in a function any more
2024-02-13Support range select removing files from a commitAaron Hoffman
2024-02-10Disallow cherry-picking merge commitsStefan Haller
2024-02-10Disallow cherry-picking update-ref todosStefan Haller
2024-02-10Cleanup: remove unused methodStefan Haller
2024-01-30Clear cherry-picked commits after pastingmolejnik88
It can be tedious after each cherry-pick opearation to clear the selection by pressing escape in order for lazygit to stop displaying info about copied commits. Also, it seems to be a rare case to cherry-pick commits to more than one destination. The simplest solution to address this issue is to clear the selection upon paste. The only exception is a merge conflict. Initially, I wanted to clear selected commits in this scenario too. During a discussion we found out that it may be convenient to have the copied commits still around. Aborting the rebase and pasting the commits in the middle of a branch can be a valid use case.
2024-01-29Add command to squash all fixups in the current branchStefan Haller
To do that, change the "Apply fixup commits" command to show a menu with the two choices "in current branch" and "above the selected commit"; we make "in current branch" the default, as it's the more useful one most of the time, even though it is a breaking change for those who are used to "shift-S enter" meaning "squash above selected".
2024-01-28Fix main view refresh after adding the first file to a custom patchStefan Haller
This broke with 240948b.
2024-01-28Support selecting file range in patch builderAaron Hoffman
test: add move_range_to_index test: add toggle_range
2024-01-28Warn users when attempting to cherry pick with old keyJesse Duffield
I wrote this feature and even I sometimes use the wrong key so I want to make this very clear to users so that there's no confusion
2024-01-28Reduce the chance of race condition with list cursorJesse Duffield
Before this commit, we had pkg/integration/tests/submodule/add.go failing with a panic. I'm pretty sure the issue is this: we're now calling quite a few GetDisabledReason calls on each layout() call, and if a background thread happens to update a model slice while we're doing this, we can end up with a selection index that's now out of bounds because it hasn't been clamped to match the new list length. Specifically, here we had the selected index being -1 (the list starts empty and somehow the value is -1 in this case) and then the list gets a new submodule so the length is now 1, but the list cursor doesn't know about this so remains on the old value. Then we confirm the length is greater than zero and try to get the selected submodule and get an out of bounds error. This commit fixes the issue by clamping the selected index whenever we get the length of the list so that it stays in-sync. This is not a perfect solution because the length can change at any time, but it seems to reliably fix the test, and using mutexes didn't seem to make a difference. Note that we're swapping the order of IFileTree and IListCursor in the file tree view model to ensure that the list cursor's Len() method is called (which performs the clamping). Also, comment from the PR: This 'trait' pattern we're using is convenient but can lead to awkward situations. In this case we have both the list view model and the (embedded) list cursor with a Len() method. The list cursor Len() method just calls the list view model Len() method. But I wanted to make it that the list view model now calls ClampSelection() on the list cursor whenever it obtains the length. This will cause an infinite loop because ClampSelection() internally calls Len() (which calls the list view model's Len() method which in turn calls ClampSelection() again, etc). The only reason we were passing the list view model into the list cursor was to supply the length method, so now we're just doing that directly, and letting the list view model delegate the Len() call to the list cursor, which now itself calls ClampSelection.
2024-01-28Display more keybindings on-screenJesse Duffield
2024-01-28Show mode-specific keybinding suggestionsJesse Duffield
As part of making lazygit more discoverable, there are certain keys which you almost certainly need to press when you're in a given mode e.g. 'v' to paste commits when cherry-picking. This commit prominently shows these keybinding suggestions alongside the others in the option view. I'm using the same colours for these keybindings as is associated with the mode elsewhere e.g. yellow for rebasing and cyan for cherry-picking. The cherry-picking one is a bit weird because we also use cyan text to show loaders and app status at the bottom left so it may be confusing, but I haven't personally found it awkward from having tested it out myself. Previously we would render these options whenever a new context was activated, but now that we need to re-render options whenever a mode changes, I'm instead rendering them on each screen re-render (i.e. in the layout function). Given how cheap it is to render this text, I think it's fine performance-wise.
2024-01-28Ensure file view length is never returned as -1Jesse Duffield
This was causing issues when obtaining selected items
2024-01-28Improve keybinding descriptionsJesse Duffield
This adds a bunch of tooltips to keybindings and updates some keybinding descriptions (i.e. labels). It's in preparation for displaying more keybindings on-screen (in the bottom right of the screen), and so due in part to laziness it shortens some descriptions so that we don't need to manage both a short and long description (for on-screen vs in-menu). Nonetheless I've added a ShortDescription field for when we do want to have both a short and long description. You'll notice that some keybindings I deemed unworthy of the options view have longer descriptions, because I could get away with it.
2024-01-26Keep same selection range when quick-starting an interactive rebaseStefan Haller
This is useful if you want to move a range of commits, so you select them, and then realize it's better to do it in an interactive rebase. Pressing 'i' preserves the range now.
2024-01-26Rename MinMax to SortRangeStefan Haller
2024-01-26Add shortcuts for filtering files by statusLuka Markušić
- 's' for showing only staged files - 'u' for showing only unstaged files - 'r' for resetting the filter
2024-01-26Use inline status for fetching remotesStefan Haller
2024-01-25Pass absolute file paths to all editor commandsStefan Haller
This helps work around bugs in editors that may get confused about relative paths (like nvim-remote, see https://github.com/neovim/neovim/issues/18519), and shouldn't have any negative effect on others.
2024-01-25Support range select for staging/discarding filesJesse Duffield
As part of this, you must now press enter on a merge conflict file to focus the merge view; you can no longer press space and if you do it will raise an error.
2024-01-24Move file discard action into files controllerJesse Duffield
It's better just having all the keybindings in one file especially when you want to share code