1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2026-05-08 22:17:45 +02:00

7463 Commits

Author SHA1 Message Date
Stefan Haller 49bb072088 Redraw only the spinner when nothing else has changed (#5571)
### PR Description
This fixes #4734, where lazygit would use a lot of CPU when the spinner
was shown due to redrawing the entire screen every time the spinner
needed a redraw.
The change adds the ability to request a UI redraw without invalidating
the full UI, thus only redrawing the spinner, re-routing the spinner to
this new flow.
CPU usage on a chromebook went from 60% to 5% when the spinner is shown.

Changing the refresh rate of the spinner from 50ms to 200ms brings it
down from 5% to 1% if ever we would like to change the default,
personally I prefer the slower moving spinner, but that's subjective.
2026-05-06 20:42:06 +02:00
Antoine Gaudreau Simard b7edcbad3a Improve performance of spinner in Synchronized events
Instead of redrawing the two views on each tick, only redraw the spinner
2026-05-06 20:38:53 +02:00
Stefan Haller 5dcc93e8cc Validate that gui.spinner.frames must all have the same width
The spinner looks weird if they don't. While we're at it, validate that frames
must not be empty, which would have crashed with a division by zero.
2026-05-06 18:53:32 +02:00
Antoine Gaudreau Simard 0d195077e4 Improve performance when drawing the spinner on background events 2026-05-06 18:53:32 +02:00
Antoine Gaudreau Simard 9c3e7dac88 Support to request a content-only UI refresh
This skips the whole-UI layout calculations, and lets tcell's dirty cell
handling redraw only changed cells.
2026-05-06 18:53:32 +02:00
Antoine Gaudreau Simard 79727f1780 Honor the spinner rate configurate with sync spinner 2026-05-06 18:53:32 +02:00
Stefan Haller 164f7da33d Fix missing layout call after switching repos
This didn't cause a bug so far because switching repos always happens from
within an OnWaitingStatus, so the spinner would take care of calling layout and
draw. However, later in this branch we are going to optimize the spinner so that
it no longer calls layout, at which point this would break, so make sure we
rerender at the point where it's needed.
2026-05-06 18:53:32 +02:00
Stefan Haller e1dff3ffa7 Fix the check_for_fixups.sh script again (#5590)
Our most recent change to the script (58309b02a9) broke it because the
anchored regex's no longer match the beginning of the subject. Fix this
by omitting the hash, which is a bit unfortunate but probably acceptable
(I rarely look at the output of the script anyway).
2026-05-06 18:53:12 +02:00
Stefan Haller af0cdf6d6e Fix the check_for_fixups.sh script again
Our most recent change to the script (58309b02a9) broke it because the
anchored regex's no longer match the beginning of the subject. Fix this by
omitting the hash, which is a bit unfortunate but probably acceptable (I rarely
look at the output of the script anyway).
2026-05-06 18:44:59 +02:00
Stefan Haller 434abc7994 Remove modifiers from keybinding (#5588)
Followup to #5563; I forgot to do this there.
2026-05-06 09:55:46 +02:00
Stefan Haller ee94e215e7 Remove dead Modifier field from keybindings
Modifiers were moved into Key in 22169e22f, but the separate Modifier field
on types.Binding and gocui.keybinding was left behind. The keypress matcher
already compares modifiers via Key.Equals, so the old field is never read on
the dispatch path; it just got passed through SetKeybinding and stored.

Drop it from gocui.keybinding, types.Binding, and the SetKeybinding /
DeleteKeybinding signatures, and remove every now-redundant Modifier:
gocui.ModNone struct field. Mouse bindings keep their own Modifier (on
ViewMouseBinding) since that path still consults it.
2026-05-06 09:51:23 +02:00
Stefan Haller 1bce7ed1c7 Remove unused function DeleteKeybinding
I noticed that it compares key.keyName and key.str separately instead of calling
key.Equals, but instead of deciding whether that's a problem, just delete the
function when nobody needs it.
2026-05-06 09:51:23 +02:00
Stefan Haller 6ed87bd5e4 Disable gh telemetry when running integration tests (#5587)
This prevents a file `test/.local/state/gh/device-id` from appearing in
the working copy after running integration tests locally.
2026-05-06 09:50:37 +02:00
Stefan Haller cb0ecda3e4 Disable gh telemetry when running integration tests 2026-05-05 18:42:28 +02:00
Stefan Haller 146f004918 Revert the change of <ctrl+j>/<ctrl+k> to <alt+down>/<alt+up> (#5582)
While I strongly prefer the alt-arrow bindings myself, I'm worried that
existing users might not be happy about the change, so I'm reverting it.

I'm working on supporting multiple keybindings for every command, so
once that's in, we can change the default to include both.
2026-05-04 18:25:16 +02:00
Stefan Haller 2332d9b27b Revert the change of <ctrl+j>/<ctrl+k> to <alt+down>/<alt+up>
While I strongly prefer the alt-arrow bindings myself, I'm worried that existing
users might not be happy about the change, so I'm reverting it.

I'm working on supporting multiple keybindings for every command, so once that's
in, we can change the default to include both.
2026-05-04 18:17:37 +02:00
Stefan Haller abe9e6c041 Add an AGENTS.md file (#5581) 2026-05-04 14:21:17 +02:00
Stefan Haller 9a2891818e Add an AGENTS.md file 2026-05-04 14:16:54 +02:00
Stefan Haller c6d73ace9a Show push URLs for remotes that have any (#5576)
In the Remotes panel, when selecting a remote that has push URLs, show
them in the main view in addition to the fetch URL(s).

Addresses half of #5566 (just the showing part, not the editing).
2026-05-04 13:13:17 +02:00
Stefan Haller 127dd9d325 Expose PushUrls to custom commands 2026-05-04 13:09:47 +02:00
Stefan Haller 6f1c57b604 Show PushUrls for selected remote if there are any 2026-05-04 13:09:47 +02:00
Stefan Haller d0ed65e0fd Add PushUrls field to models.Remote
Add some tests for RemoteLoader while we're at it; we didn't have any.
2026-05-04 13:09:47 +02:00
Stefan Haller 59b9b5959d Use more widely-supported Unicode symbols for the commit graph (#5573)
The commit graph used '⏣' (U+23E3 BENZENE RING WITH CIRCLE) for merge
commits and '◯' (U+25EF LARGE CIRCLE) for regular commits. Both have
very poor coverage in popular monospace fonts:

- '⏣' lives in the Misc Technical block and is essentially absent from
every common monospace font (Source Code Pro, JetBrains Mono, Fira Code,
Cascadia Code, Hack, Iosevka, Menlo, Consolas, Monaco, IBM Plex Mono,
Ubuntu Mono, Noto Sans Mono, Inconsolata). It is always drawn from a
system fallback font.
- '◯' is the late-addition LARGE CIRCLE codepoint. It is present in some
fonts (Cascadia, Fira Code, Hack, Iosevka, Menlo, Noto Sans Mono) but
missing from many others, including Source Code Pro and most Nerd Font
derivatives based on it.

This is why the graph renders inconsistently across platforms even when
the same monospace font is configured: each OS picks a different
fallback font (Apple Symbols on macOS, Segoe UI Symbol on Windows,
Noto/DejaVu/Symbola on Linux), and the substituted glyphs differ in
shape, weight, and advance width. '◯' is also East Asian Ambiguous
width, so some terminals render it wider than one cell, exaggerating the
misalignment.

Replace the symbols with codepoints from the foundational 1991 Geometric
Shapes block, which has far broader font coverage:

- Merge: '◎' U+25CE BULLSEYE -- concentric circles, the visually closest
cousin to the previous benzene-ring glyph.
- Commit: '○' U+25CB WHITE CIRCLE -- the same hollow-circle silhouette
as before, just a more universally available codepoint.

The new symbols are present in the font directly in significantly more
cases; and when fallback is still required, they are universally
well-drawn (unlike '⏣', which many fallback fonts also lack).

I also considered choosing suitable nerd font symbols for those who are
using nerd fonts, on the assumption that these must work better because
they are guaranteed to be in the font and no fallback font substitution
is necessary; several suitable icons could be considered, e.g.
`nf-cod-circle_large` or `nf-md-circle_double`. Surprisingly, these
didn't work well, and the reason is that (at least in the font I am
using) these are defined with a glyph width that is wider than their
advance width, which means they draw in different sizes depending on
whether they are followed by a space or not. The glyphs we picked above
don't have this problem.

And finally, I considered adding config options so that users with weird
fonts can pick symbols that work well for them. I would like to avoid
having to do this though; ideally we should be able to make a choice
that works well for everybody.
2026-05-04 13:09:28 +02:00
Stefan Haller 35d3659cce Use more widely-supported Unicode symbols for the commit graph
The commit graph used '⏣' (U+23E3 BENZENE RING WITH CIRCLE) for merge
commits and '◯' (U+25EF LARGE CIRCLE) for regular commits. Both have
very poor coverage in popular monospace fonts:

- '⏣' lives in the Misc Technical block and is essentially absent from
  every common monospace font (Source Code Pro, JetBrains Mono, Fira
  Code, Cascadia Code, Hack, Iosevka, Menlo, Consolas, Monaco, IBM
  Plex Mono, Ubuntu Mono, Noto Sans Mono, Inconsolata). It is always
  drawn from a system fallback font.
- '◯' is the late-addition LARGE CIRCLE codepoint. It is present in
  some fonts (Cascadia, Fira Code, Hack, Iosevka, Menlo, Noto Sans
  Mono) but missing from many others, including Source Code Pro and
  most Nerd Font derivatives based on it.

This is why the graph renders inconsistently across platforms even
when the same monospace font is configured: each OS picks a different
fallback font (Apple Symbols on macOS, Segoe UI Symbol on Windows,
Noto/DejaVu/Symbola on Linux), and the substituted glyphs differ in
shape, weight, and advance width. '◯' is also East Asian Ambiguous
width, so some terminals render it wider than one cell, exaggerating
the misalignment.

Replace the symbols with codepoints from the foundational 1991
Geometric Shapes block, which has far broader font coverage:

- Merge: '◎' U+25CE BULLSEYE -- concentric circles, the visually
  closest cousin to the previous benzene-ring glyph.
- Commit: '○' U+25CB WHITE CIRCLE -- the same hollow-circle silhouette
  as before, just a more universally available codepoint.

The new symbols are present in the font directly in significantly
more cases; and when fallback is still required, they are universally
well-drawn (unlike '⏣', which many fallback fonts also lack).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 13:06:29 +02:00
Stefan Haller bbc254253d Fix new gopls linter warnings (#5580)
These have started to pop up in my editor after the last gopls update,
and I like my IDE's problems panel to be clean, so fix them.
2026-05-04 13:05:21 +02:00
Stefan Haller 8dbdd74400 Fix linter warnings about ignoring errors from bufio.Scanner 2026-05-03 16:57:24 +02:00
Stefan Haller 562d0541a1 Fix linter warning about inefficient string concatenation 2026-05-03 16:39:41 +02:00
Stefan Haller f2ff1eb24b Fix failing windows tests (#5574)
See commit messages for details.
2026-05-02 18:04:34 +02:00
stk 7fbc2a8c14 Close temp file handles before cleanup on Windows
Windows cannot remove files while handles are still open. In
TestOSCommandFileType we created files and immediately called RemoveAll without
closing handles, which left untracked artifacts (e.g. "testFile" and "file with
spaces") in the working tree. Close the handles and assert RemoveAll succeeds so
cleanup failures are visible.
2026-05-02 17:59:27 +02:00
stk 3ffc4ac832 Remove now unnecessary Setenv call
The call was meant to guarantee a UTC time zone to make the tests deterministic,
but as the previous commit explained, this only worked on Mac and Linux, not on
Windows. Since we now have a better fix, this workaround is no longer needed.
2026-05-02 17:59:27 +02:00
stk 5761f92e16 Make UnixToDateSmart timezone-deterministic
The "custom time format" test case of TestGetCommitListDisplayStrings failed on
Windows. Root cause: UnixToDateSmart used time.Unix(timestamp, 0), which formats
in process-local time. In tests we pass an explicit 'now' (often UTC), but the
timestamp was rendered in Local, causing one-hour drift on non-UTC machines.

The test tried to work around this by doing os.Setenv("TZ", "UTC"); however,
this only worked on Mac and Linux. On Windows, it has no effect because Windows
uses registry-based timezone configuration, not TZ environment variables.

Change: convert the timestamp into now.Location() before both the same-day
comparison and formatting.

Why this is safe: callers already define the presentation timezone via the 'now'
argument (typically time.Now() in app code, controlled time in tests). This
aligns timestamp rendering with that caller intent and removes dependence on
global TZ state or OS-specific environment variable behavior.

Added regression tests for UTC and UTC+1 to ensure deterministic behavior across
all platforms.
2026-05-02 17:59:27 +02:00
Stefan Haller 8bc329a5a6 Clear LC_* env vars when running LANG tests (#5568)
In the event that LC_ALL was set, for example, the tests would fail as
it takes precedence over LANG.

Tiny change that prevents language tests from failing if LC_ALL is set
(I also added LC_MESSAGES but I am not sure if that's also needed, from
what I read it also takes precedence) so I did not open an issue prior,
hopefully that's ok!
2026-05-01 08:16:22 +02:00
Antoine Gaudreau Simard f4e0e9e93c Clear LC_* env vars when running LANG tests
In the event that LC_ALL was set, for example, the tests would fail as
it takes precedence over LANG
2026-05-01 08:13:52 +02:00
Stefan Haller 749bb2901a Fix regressions with alternate edit bindings for backspace and move-cursor-right (#5570)
These have alternate keys (`<ctrl+h>` for backspace, and `<ctrl+f>` for
move-cursor-right). Both of these broke with commit 22169e22ffc46c5; the
first because it was accidentally omitted, the second because of a
stupid copy/paste mistake.
2026-05-01 08:11:09 +02:00
Stefan Haller dadc5ffede Fix regressions with alternate edit bindings for backspace and move-cursor-right
These have alternate keys (<ctrl+h> for backspace, and <ctrl+f> for
move-cursor-right). Both of these broke with commit 22169e22ffc46c5; the first
because it was accidentally omitted, the second because of a stupid copy/paste
mistake.
2026-05-01 08:06:01 +02:00
Stefan Haller dc44e0e231 Change canonical keybinding syntax (<ctrl+a> instead of <c-a>) (#5565)
In #5563 we started to support an alternative syntax for keybindings:
instead of `<c-a>` you could say `<ctrl+a>`, which is easier to read
especially when there are multiple modifiers (`<ctrl+shift+x>` instead
of `<c-s-x>`). In this PR we make this new syntax the default.
2026-04-30 22:46:03 +02:00
Stefan Haller 6663867bb5 Change keybinding syntax to spell out full modifier names, and use + instead of -
The change to filter_menu_by_keybinding.go is needed because + now occurs in
many keybindings, so pick a different one that occurs only once.
2026-04-30 22:38:53 +02:00
Stefan Haller 74a6ea85c8 Remove the keybindings legend in the cheatsheets
With the new longer syntax that we are about to make the default in the next
commit it is no longer needed.
2026-04-30 22:38:53 +02:00
Stefan Haller ccae993b40 Platform-specific edit bindings for move-by-word and backspace-word (#5564)
Make the edit keybindings for "move-by-word" and "backspace-word"
platform-dependent so that they are with ctrl on Windows and Linux, but
alt on Mac. These are the common conventions on these platforms. Also,
make them configurable so that user who can't get used to the change can
map it back to what they were.

Add a "forward-delete-word" keybinding, bound to alt-delete on Mac, and
ctrl-delete on Windows and Linux.
2026-04-30 22:38:35 +02:00
Stefan Haller bfdea2bb4f Add a forwardDeleteWord keybinding
Bound to alt-delete on Mac, and ctrl-delete on Windows and Linux.
2026-04-30 22:31:44 +02:00
Stefan Haller 976dbec9ff Make edit keybindings for move-by-word and backspace-word configurable
And make them platform dependent so that they are with ctrl on Windows and
Linux, but alt on Mac.
2026-04-30 22:31:44 +02:00
Stefan Haller 396e1ae8b9 Keybinding revamp (#5563)
Revamp lazygit's keybinding mechanism to support richer keybindings for
those terminals that support the newer keyboard protocols. This makes it
possible to use keybindings such as `ctrl-alt-shift-x`.

Change the default keybindings for moving commits up and down from
`ctrl-k`/`ctrl-j` to `alt-up`/`alt-down`; this is mostly for personal
preference, I find them easier to remember, and they are nicely similar
to moving a line of code up and down in many code editors. Also, change
the default binding for submitting a commit from the commit description
editor from `alt-enter` to `command-enter` on Mac, or `ctrl-enter` on
Linux and Windows; these are the same bindings that are used in many
multi-line edit field situations, e.g. in GitHub comments.

See docs/keybindings/Custom_Keybindings.md for caveats about terminal
compatibility.
2026-04-30 22:30:27 +02:00
Stefan Haller 8a6c97a920 Add breaking changes note for the changed bindings 2026-04-30 22:22:53 +02:00
Stefan Haller f5cefc8a58 Change bindings for moving commits to a-up/down
These are the same as many editors (e.g. VS Code) use for moving a line up/down,
so they are easy to remember.
2026-04-30 22:22:53 +02:00
Stefan Haller 578ee9a31b Change a-enter keybinding to m-enter on mac, and c-enter elsewhere 2026-04-30 22:22:53 +02:00
Stefan Haller 09d671e642 Document custom keybinding syntax
The previous version only enumerated the supported (non-rune) bindings.
Replace it with a description of the syntax: how to spell single-rune
keys, special keys, and modified keys; how to combine modifiers; the
keyword forms for `<space>`, `<minus>`, `<plus>`; and which combinations
are rejected because terminals can't deliver them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 22:22:53 +02:00
Stefan Haller 22169e22ff Move modifiers into Key
This changes not only how we store modifiers (inside of Key instead of passing
it separately), but also how we parse keybinding strings: it supports all
combinations of modifiers now (if the terminal supports it, that is).
2026-04-30 22:22:53 +02:00
Stefan Haller 30b619b3db Get rid of pkg/gui/keybindings package
Move keybindings.GetKey to config.GetValidatedKeyBindingKey
2026-04-30 22:22:53 +02:00
Stefan Haller c41fae9fc4 Unexport the labelByKey and keyByLabel maps 2026-04-30 22:22:53 +02:00
Stefan Haller 69e99ffd64 Move keybindings.LabelFromKey to config package
So that it is next to KeyFromLabel.
2026-04-30 22:22:53 +02:00