1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00
Commit Graph

3161 Commits

Author SHA1 Message Date
Stefan Haller
843e12286f Improve prompts when amending commits
This fixes two minor problems with the prompts:

1. When pressing shift-A in the local commits view, it would first prompt
   whether to stage all files, and then it would prompt whether to amend the
   commit at all. This doesn't make sense, it needs to be the other way round.

2. When pressing shift-A on the head commit in an interactive rebase, we would
   ask whether they want to amend the last commit, like when pressing shift-A in
   the files view. While this is technically correct, the fact that we're
   amending the head commit in this case is just an implementation detail, and
   from the user's point of view it's better to use the same prompt as we do for
   any other commit.

To fix these, we remove the confirmation panel from AmendHelper.AmendHead() and
instead add it at the two call sites, so that we have more control over this.
2023-09-01 18:55:16 +02:00
Stefan Haller
de4224bbe4 Fix escape not cancelling filter mode, but closing the menu instead
When filtering is on in a menu, pressing esc should only cancel the filter, but
not close the menu.
2023-08-30 22:37:13 +02:00
Stefan Haller
81216189e4 Don't show toasts when running integration tests
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-08-30 10:54:32 +02:00
Stefan Haller
1ba8d3060b Ensure committable files for "amend to" and "create fixup commit"
These would previously fail with confusing error messages when no files were
staged.

The diff is best viewed with "ignore whitespace" turned on.
2023-08-29 09:10:59 +02:00
Stefan Haller
f561007fb7 Extract a WithEnsureCommitableFiles function
This encapsulates the logic to make sure we have something to commit; which is
to
- auto-stage all files if no files are staged and the SkipNoStagedFilesWarning
config is on
- otherwise, prompt the user whether they want to stage all files
- error out if we don't have any files at all

Of these, the first one was only done when committing with the built-in commit
message panel; there's no reason why it shouldn't also be done when committing
with the editor, or when amending, and now it is.
2023-08-29 09:10:59 +02:00
Stefan Haller
df38e954f4 Add integration test for the new divergence log 2023-08-29 08:16:40 +02:00
Stefan Haller
ea532b4729 Add DoesNotContainAnyOf matcher 2023-08-29 08:16:40 +02:00
Stefan Haller
572d1b5920 Add "Show divergence from upstream" entry to Upstream menu in branches panel 2023-08-29 08:16:40 +02:00
Stefan Haller
e8fac6ca73 Extract a SubCommitsHelper from SwitchToSubCommitsController
We want to use it from BranchesController too.
2023-08-29 08:16:40 +02:00
Stefan Haller
4de3fadb00 Remove sub_commits_context's Title method
It implemented this because it wants to do custom truncation of the ref name;
however, we can achieve the same thing by passing the truncated ref name to our
DynamicTitleBuilder, which was previously unused.
2023-08-29 08:16:40 +02:00
Stefan Haller
12f24aa8b4 Add option RefToShowDivergenceFrom to GetCommitsOptions
Not used yet.
2023-08-29 08:16:40 +02:00
Stefan Haller
911aa7774b Don't return commits from setCommitMergedStatuses
Since the slice stores pointers to objects, and we're only modifying the objects
but not the slice itself, there's no need to return it and assign it back. This
will allow us to call the function for subslices of commits.

Also, move the condition that checks for an empty string inside the function;
we're going to call it from more than one place, so this makes it easier.
2023-08-29 08:16:40 +02:00
Stefan Haller
94bf279b5a Remove the magenta color on menu items that open a menu
It's distracting. But keep the ellipsis.
2023-08-29 08:04:47 +02:00
Stefan Haller
37381b610d Add sections (local, global) to the keybindings menu 2023-08-29 08:04:47 +02:00
Stefan Haller
6d4df57393 Add option to add sections to menus 2023-08-29 08:04:47 +02:00
Stefan Haller
3df01aaff0 Add a mechanism to insert non-model items into list contexts
Not used by anything yet.
2023-08-29 08:04:47 +02:00
Stefan Haller
4ee4f6f34b Make columnPositions include entries for removed columns
We will pass these positions back to clients for rendering non-model items, and
it's important that clients can consistently rely on them no matter which
columns were removed.
2023-08-28 14:21:06 +02:00
Stefan Haller
7953f7fa86 Make RenderDisplayStrings return the column positions
Not used by anything yet, but we'll need it later in this branch.
2023-08-28 14:21:06 +02:00
Stefan Haller
7a8df7795c Take removed columns into account when applying column alignments 2023-08-28 14:21:06 +02:00
Stefan Haller
aa493d3a9e Add failing test demonstrating bug with column alignments and removed columns
When columns to the left of a column with an alignment are removed, the
alignment applies to the wrong column. We'll fix this in the next commit.
2023-08-28 14:21:06 +02:00
Stefan Haller
72731f2c16 Change RenderDisplayStrings to return a slice of strings
We'll join them with newlines afterwards. This will make it easier to insert
other (non-model) items.
2023-08-28 14:21:06 +02:00
Stefan Haller
f680b6e82e Cleanup: use slices.Delete to delete elements from a slice
I find this much easier to read.
2023-08-28 14:21:06 +02:00
Stefan Haller
ec22570eac Add tests for renderLines
These are very simple yet, but we'll extend them in the next commits.
2023-08-28 14:21:06 +02:00
Stefan Haller
198ead7c14 Extract a ListRenderer struct
I'm doing this not so much because it's a great abstraction, but just because it
will make it much easier to write tests for it.
2023-08-28 14:21:06 +02:00
Stefan Haller
297a020abf Call getDisplayStrings with a valid range of model indices
It's nicer if clients can rely on the indices being valid, and don't have to
clamp themselves.
2023-08-28 14:21:06 +02:00
Stefan Haller
473d989cde Extract a renderLines function
We'll make some changes to how the display strings are rendered, so it helps to
have this code only once. This also fixes the problem that contexts using
refreshViewportOnChange weren't able to use column alignments so far. We didn't
need this yet, but it's just nice if everything works. :)
2023-08-28 14:21:06 +02:00
Stefan Haller
061bfce835 Change length parameter of getDisplayStrings to endIdx
It's more natural to work with this way, as we will see later in this branch.
2023-08-28 14:21:06 +02:00
Jesse Duffield
996e30e5d9
Add icons for files with .mdx and .svelte file extensions (#2889) 2023-08-28 20:25:03 +10:00
Jesse Duffield
28353da61b
Allow adding a port to webDomain part of services config (#2908) 2023-08-28 19:38:45 +10:00
Mark Skelton
6dc34d19ea
Support custom keybindings for confirm discard 2023-08-25 08:50:05 -05:00
Stefan Haller
98e6c119f5 Select same commit again after pressing "e" to edit a commit
When editing a commit, the index of the current commit can change; for example,
when merge commits are involved, or when working with stacked branches where
"update-ref" commands may be added above the selected commit.

Reselect the current commit after pressing "e"; this requires doing the refresh
blocking on the main thread. (Another option that I considered was to use a
SYNC refresh, and then select the new line with an OnUIThread inside the Then
function. This also works, but results in a very visible lag.)
2023-08-22 14:08:12 +02:00
Stefan Haller
c718a73d0a Call Then function only after everything is done
I'm actually surprised how this could even have worked before.
2023-08-22 14:06:31 +02:00
Stefan Haller
d74c817fd8 Panic when trying to use RefreshOptions.Then with mode ASYNC
This doesn't work, and since it took me a while of debugging to figure this out,
alert other developers earlier when they try to do it.
2023-08-22 14:06:31 +02:00
Stefan Haller
93d19db158 Add assertion to show the problem 2023-08-22 14:06:29 +02:00
Raido Oras
d7b611aa05 Allow port in webDomain for services config values 2023-08-21 14:33:58 +03:00
Stefan Haller
91ec42f3f8 Add integration test 2023-08-21 10:03:34 +02:00
Stefan Haller
8f628296ad Mention ctrl+o binding in commit message sub title
Only do this when an onSwitchToEditor function is actually provided. For the
"Move patch into new commit" command we don't, because it isn't totally
straightforward in that case.
2023-08-21 10:03:34 +02:00
Stefan Haller
61bd3e8dd2 Add key binding for switching from the commit message panel to an editor
This is useful for when you begin to type the message in lazygit's commit panel,
and then realize that you'd rather use your editor's more powerful editing
capabilities. Pressing <c-o> will take you right there.
2023-08-21 10:03:34 +02:00
Stefan Haller
7263630967 Remove obsolete comment 2023-08-21 10:03:34 +02:00
Stefan Haller
b2d629b50a Add scrollOffEnabled config 2023-08-21 09:03:45 +02:00
Stefan Haller
125d4fa9dc Pass UserConfig to checkScrollUp/Down instead of just the scrollOffMargin
This will allow us to add a scrollOffEnabled config and have the functions
respect it without changes to clients.
2023-08-21 08:10:28 +02:00
Stefan Haller
527a1596f3 Add tests for scroll-off margin of zero 2023-08-21 08:10:28 +02:00
Jesse Duffield
6a6cb25d7e
Handle trailing slash in worktree path (#2947) 2023-08-21 13:26:58 +10:00
Stefan Haller
2073730186 Fix the commit graph display after selection jumps in commits view
When navigating in the commits view to a line that is out of view (e.g. by
pressing , or . to scroll by page, or < or > to scroll to the top or bottom),
the commit graph was not correctly highlighted. Fix this by rerendering the
viewport in this case.
2023-08-20 08:46:04 +02:00
Cristian Betivu
7a4a0c85c4 Fix test 2023-08-19 19:12:36 +03:00
Cristian Betivu
382ecb6bfe Add unit test 2023-08-19 19:10:35 +03:00
Cristian Betivu
03694f7502 Fix arg order to asserts 2023-08-19 19:10:25 +03:00
Cristian Betivu
ee308a4994 Clean before convertion? 2023-08-19 18:36:57 +03:00
Cristian Betivu
a2b2336173 Stylistic changes 2023-08-19 18:36:57 +03:00
Cristian Betivu
d7b1deb465 Clean path 2023-08-19 18:36:57 +03:00