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

1996 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Stefan Haller
b1314349d7 Fix yellow/red coloring while rebasing
It determines the yellow/red status by getting the merge-base between the
current branch and its upstream; while we're rebasing, the current branch is
HEAD, so it tried to get the merge-base between HEAD and HEAD{u}, which doesn't
work. Fix this by passing the name of the checked-out branch separately.
2023-08-19 09:26:27 +02:00
Ching Pei Yang
84372cfad9 Add emacs-keybinds for word navigation 2023-08-15 12:22:17 +02:00
Stefan Haller
341b9725d4 Add ScrollOffMargin user config
When set to a non-zero value, views will scroll when the selection gets this
close to the top or bottom of the view.
2023-08-15 11:40:40 +02:00
Stefan Haller
8f164f7bc5 Stop cycling hunks when reaching the end
Previously, when pressing right-arrow when the cursor is already in the last
hunk, it would jump back to the beginning of that hunk. This can be confusing if
the hunk is long, maybe the start of the hunk is already scrolled off the top of
the window, and then pressing right-arrow actually scrolls *backwards*, which is
counter-intuitive. It's better to do nothing in this case.

Same for left-arrow when the cursor is already in the first hunk, although here
the problem is not so severe (unless diff context was increased by a huge
amount, and the start of the first hunk is scrolled off the bottom of the
window).
2023-08-15 11:40:40 +02:00
Stefan Haller
79c11a0458 If selected line is outside, move it to the middle of the view
Previously, the current line was only moved as much as necessary so that it's in
view again. This had the problem that when jumping downwards from hunk to hunk
with the right-arrow key, only the first line of the new hunk was shown at the
bottom of the window. I prefer to put the selected line in the middle of the
view in this case, so that I can see more of the newly selected hunk.

This has the consequence that when scrolling through the view line by line using
down-arrow, the view jumps by half a screen whenever I reach the bottom. I can
see how some users might be opposed to this change, but I happen to like it too,
because it allows me to see more context of what's ahead.
2023-08-15 11:40:40 +02:00
Stefan Haller
4a4afc4639 Fix typo in comment 2023-08-15 11:40:40 +02:00
Jesse Duffield
e6356ce10c Show commit mark before showing extra info
The 'YOU ARE HERE' marking should be shown before we show things like the current tag, otherwise it could be missed
2023-08-12 16:34:04 +10:00
Jesse Duffield
f1753f36c8 Add rebase from marked base commit test
This also fixes a bug where after the rebase each commit in the commits view had a tick against it because we hadn't
refreshed the view since the base commit was no longer marked
2023-08-12 16:16:03 +10:00
Federico
0df5cb1286
Allow deleting remote tags/branches from local tag/branch views (#2738) 2023-08-10 17:39:26 +10:00
Jesse Duffield
c43830b027
Support editing files in existing neovim instance (#2916) 2023-08-10 17:23:58 +10:00
Simon Whitaker
54776052a1 If OpenLink errors, show a dialog instead
If the command used by OSCommand.OpenLink fails, lazygit crashes. With this change, if the OpenLink command fails, lazygit just shows a dialog inviting the user to visit the relevant URL.

Fixes #2882
2023-08-09 13:12:40 +01:00
Jesse Duffield
9c5eedf748 use 'suspend' instead of 'editInTerminal' internally
'suspend' is a more appropriate name, especially now that you can choose not to suspend despite
still being in a terminal
2023-08-09 22:03:58 +10:00
Jesse Duffield
9e7018db8a Honour editInTerminal value when opening a worktree folder
There was no good reason not to do this in the first place.
2023-08-09 21:00:27 +10:00
Jesse Duffield
4b0432423d Reset origin when clearing view 2023-08-08 22:01:43 +10:00
Simon Whitaker
ed1547e0cb Add a Click() primitive to the integration test library 2023-08-07 15:10:28 +01:00
Jesse Duffield
595e28d335 Support bare worktrees where worktree does not have its own .git file
This was on oversight on my part: I assumed that the --work-tree arg was
always intended for use with linked worktrees which have a .git file
pointing back to the repo.

I'm honestly confused now: seems like there are three kinds of worktrees:
* the main worktree of a non-bare repo
* a linked worktree (with its own gitdir in the repo's worktrees/ dir)
* a random folder which you specify as a worktree with the --work-tree arg

I'm pretty sure the --work-tree arg is only intended to be used with this
third kind or workree
2023-08-07 22:40:53 +10:00
Stefan Haller
d1754a9490
update worktree icons for NerdFont V3 (#2895) 2023-08-07 08:16:42 +02:00
Saafo
77447ea6c3 👽️ update worktree icons for NerdFont V3 2023-08-07 05:47:57 +00:00
Harshit Tomar
e78a09ebab
added svelte and mdx 2023-08-06 20:26:07 +10:00
Stefan Haller
7ccb871a45 Bump gocui
... and import stefanhaller's tcell fork for real rather than just replacing it

This solves the problem that people trying to
"go install github.com/jesseduffield/lazygit@latest" would get the error

go: github.com/jesseduffield/lazygit@latest (in github.com/jesseduffield/lazygit@v0.40.0):
  The go.mod file for the module providing named packages contains one or
  more replace directives. It must not contain directives that would cause
  it to be interpreted differently than if it were the main module.
2023-08-06 12:03:23 +02:00
Jesse Duffield
ec7e9f9228 Fix confirmation view sizing
The proper fix is to actually have these two functions share code,
or for views to be able to manage their own heights based on their contents.

But I want to get this out for the sake of a Lazygit Anniversary release.
2023-08-05 16:09:02 +10:00