Commit graph

304 commits

Author SHA1 Message Date
Stefan Haller c0b6f4adb9 Bump gocui 2026-01-03 14:39:03 +01:00
Stefan Haller 5423e7459c Replace go-runewidth with uniseg 2025-12-23 16:49:16 +01:00
Stefan Haller fec7e9ce61 Bump gocui (and tcell)
and adapt lazygit's client code accordingly.
2025-12-23 16:49:16 +01:00
Stefan Haller b4b21f9c65 Fix race condition in HandleRender
Move SetContentLineCount into OverwriteLinesAndClearEverythingElse. Calling it
separately beforehand is not concurrency safe; we need both to happen
when the view's writeMutex is locked.
2025-12-23 16:20:32 +01:00
Stefan Haller efd4298b5e Avoid scrolling the selection into view on refresh
It is possible to scroll the selection out of view using the mouse wheel; after
doing this, it would sometimes scroll into view by itself again, for example
when a background fetch occurred. In the files panel this would even happen
every 10s with every regular files refresh.

Fix this by adding a scrollIntoView parameter to HandleFocus, which is false by
default, and is only set to true from controllers that change the selection.
2025-12-23 15:34:38 +01:00
Stefan Haller 2189c3b43a Bump gocui
This brings in the fix "Prevent many hyperlinks from launching while mouse
moving".

Co-authored-by: Chris McDonnell <c.a.mcdonn@gmail.com>
2025-12-22 16:22:36 +01:00
Stefan Haller b06c2bb025 Remove the 'minimal' dependency which we no longer need 2025-11-21 07:57:56 +01:00
dependabot[bot] 1b60c9d7c6
Bump golang.org/x/crypto from 0.37.0 to 0.45.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.37.0 to 0.45.0.
- [Commits](https://github.com/golang/crypto/compare/v0.37.0...v0.45.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.45.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-20 02:01:56 +00:00
kyu08 76452a0bcc Add ignore directive in go.mod
This can be used by go tools such as gofumpt.
2025-10-20 07:56:56 +02:00
kyu08 93b8d70209 Update go to 1.25 2025-10-05 10:17:03 +02:00
Stefan Haller ef92e30315 Bump gocui
The main change here is https://github.com/jesseduffield/gocui/pull/85, which
avoids breaking lines after footnote symbols in commit messages (e.g. [1]).

[1]: https://www.example.com/this-is-a-really-long-url-that-lazy-git-automatically-wraps-and-is-an-issue
2025-10-02 17:28:13 +02:00
Stefan Haller f689b32c33 Bump the go-deadlock dependency to v0.3.6
This is needed for compatibility with go 1.25.
2025-09-20 10:51:37 +02:00
Stefan Haller ffccfd6e42 Bump git-todo-parser
This fixes a crash in an interactive rebase when there's a merge command in the
rebase-todo file that doesn't have a comment. I don't know under what
circumstances this can happen; git itself doesn't produce these, but it is
theoretically possible for the user to do this manually by doing `git rebase
--edit-todo`, or third-party tools could do it too.

We had one user report a crash because of this, so it seems worth fixing it.
2025-09-05 10:37:20 +02:00
cowboy8625 0f38d2d61e Implement suspending the app using ctrl-z
Co-authored-by: Stefan Haller <stefan@haller-berlin.de>
2025-08-14 20:41:46 +02:00
Stefan Haller 1a72561b15 Remove the kill package dependency 2025-08-01 10:32:47 +02:00
Stefan Haller 0245d663c0 Bump gocui 2025-07-11 10:26:09 +02:00
dependabot[bot] f07c08a071
Bump github.com/cloudflare/circl from 1.6.0 to 1.6.1
Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.6.0...v1.6.1)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-version: 1.6.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-30 14:00:23 +00:00
Stefan Haller 9e64f7dd66 Bump gocui and adapt lazygit code
Adaptions are for this gocui commit:

Cleanup: remove Is* error functions

- Use errors.Is instead of quality comparisons. This is better because it
  matches wrapped errors as well, which we will need later in this branch.
- Inline the errors.Is calls at the call sites. This is idiomatic go, we don't
  need helper functions for this.

See https://go.dev/blog/go1.13-errors for more about this.
2025-06-05 13:20:38 +02:00
Stefan Haller 5dbd91038a Bump gocui
See https://github.com/jesseduffield/gocui/pull/80.

This fixes selecting hunks in the staging view that are longer than the screen.
2025-05-29 14:33:17 +02:00
Stefan Haller c80b0e1910 Bump gocui 2025-05-22 08:48:14 +02:00
Stefan Haller 5686e63af3 Bump generics dependency 2025-05-21 08:51:24 +02:00
Stefan Haller 14eb4c29ca Bump git-todo-parser 2025-04-29 14:57:15 +02:00
Stefan Haller 6c0ee7df2b Bump gocui 2025-04-21 18:03:11 +02:00
Stefan Haller b78aa54439 Use dario.cat/mergo instead of github.com/imdario/mergo
It's the new canonical location as of 1.0.0, the old one is deprecated and stuck
on 0.3.something.
2025-04-09 11:23:55 +02:00
Stefan Haller 4cf49ff449 Bump go-git 2025-04-09 11:23:55 +02:00
Stefan Haller 7322cf1a9e Bump gocui
This includes a fix to render hyperlinks in the last line of a view if it
doesn't end with a line feed; see
https://github.com/jesseduffield/gocui/pull/77.
2025-04-08 16:05:34 +02:00
Brandon c488e22abc Bump generics dependency 2025-04-06 22:18:20 -07:00
Kevin Radloff 14ba0e7523 Specify a go release minor version
Since they started releasing .0 versions with 1.21.0, the go version
need to be a full release version specifier and not a go language
version. They relented and added support for defaulting to a .0 release
if none is specified in later 1.23.x releases, but for users with local
1.21 or 1.22 toolchains the lack of a full release specifier breaks
them. And going forwards this is more technically correct anyway.

See https://github.com/golang/go/issues/62278#issuecomment-1693620853
2025-03-21 08:28:18 -04:00
Kevin Radloff be7583dd40 Update to go 1.24 2025-03-08 14:53:54 -05:00
Karim Khaleel 30e9bf8a75 Use refs in jsonschema userconfig generator
This makes it possible to use recursive structures in the user config.
2025-02-23 20:55:28 +01:00
Stefan Haller ac3824bd7c Bump gocui 2025-02-20 09:13:54 +01:00
Stefan Haller 46ebfbbe87 Bump gocui 2025-02-10 13:40:22 +01:00
Chris McDonnell f117eed614 go-deadlock version bump to fix crash with go 1.23 2025-02-10 01:43:35 -05:00
Stefan Haller 050a91b7d1 Bump gocui
This improves the contrast of highlighted search results by setting the
foreground color to black.
2025-02-07 14:20:49 +01:00
Stefan Haller fe429c6184 Bump gocui 2025-01-20 17:52:51 +01:00
Jesse Duffield 5e26183ae1 Bump tcell to fix broken deployment 2025-01-18 00:31:57 +11:00
Stefan Haller 274e24d75e Bump gocui (and tcell)
This updates our tcell dependency to v2.8.0, adding support for ghostty and
tmux-256color.
2025-01-12 13:48:52 +01:00
Stefan Haller 49ca7f6a84 Bump gocui 2025-01-07 17:39:01 +01:00
Stefan Haller ae53059ed2 Bump gocui
This updates gocui to include https://github.com/jesseduffield/gocui/pull/68 and
https://github.com/jesseduffield/gocui/pull/69, which changes views to not have
an extra blank line at the end when content ending in a newline character is
written to them. This makes text views more consistent with list views, which
don't have a blank line after the last list entry either.
2025-01-07 17:34:30 +01:00
Jesse Duffield 3241a9c251 Bump crypto and net packages
The old versions had some CVEs which I'm almost certain were not
relevant to lazygit but this means I get to close a couple PRs easily.
2025-01-03 14:01:26 +11:00
Jesse Duffield fdf1643f63 Bump kill package
This should reduce the instances of killing random processes on windows.

See https://github.com/jesseduffield/kill/pull/1
2025-01-01 23:45:53 +11:00
Stefan Haller 2417b70acd Bump gocui 2024-12-23 12:24:09 +01:00
Stefan Haller f6f2a52dee Bump gocui and adapt lazygit code
Original commit message of the gocui change:

This fixes View.Size, Width and Height to be the correct (outer) size of a view
including its frame, and InnerSize/InnerWidth/InnerHeight to be the usable
client area exluding the frame. Previously, Size was actually the InnerSize (and
a lot of client code used it as such, so these need to be changed to InnerSize).
InnerSize, on the other hand, was *one* less than Size (not two, as you would
have expected), and in many cases this was made up for at call sites by adding 1
(e.g. in calcRealScrollbarStartEnd, parseInput, and many other places in the
lazygit code).

There are still some weird things left that I didn't address here:
- a view's lower-right coordinates (x1/y1) are one less than you would expect.
  For example, a view with a 2x2 client area like this:
    ╭──╮
    │ab│
    │cd│
    ╰──╯
  in the top-left corner of the screen (x0 and y0 both zero) has x1/xy at 3, not
  4 as would be more natural.
- a view without a frame has its coordinates extended by 1 on all sides; to
  illustrate, the same 2x2 view as before but without a frame, sitting in the
  top-left corder of the screen, has coordinates x0=-1, y0=-1, x1=2, y1=2. This
  is highly confusing and unexpected.

I left these as they are because they would be even more of a breaking change,
and also because they don't have quite as much of an impact on general app code.
2024-12-01 10:40:08 +01:00
Stefan Haller 65b731f484 Bump gocui 2024-09-28 12:04:51 +02:00
Stefan Haller 5659f1f3e9 Bump gocui
And adapt client code.
2024-09-06 08:45:48 +02:00
Stefan Haller 8d37f48744 Bump gocui 2024-08-24 17:45:51 +02:00
Stefan Haller 5380fe2483 Fix rendering regression introduced in #3839 2024-08-24 11:46:53 +02:00
Stefan Haller 0aa351443f Bump gocui 2024-08-24 10:47:25 +02:00
Stefan Haller 250eb14de1 Bump gocui 2024-08-24 10:35:59 +02:00
Stefan Haller 59450c7d12 Bump gocui 2024-08-24 10:21:25 +02:00
Stefan Haller 07dd8a2b07 Bump gocui 2024-08-18 10:24:52 +02:00
Stefan Haller da8e4e44b7 Bump gocui 2024-08-17 10:50:32 +02:00
Stefan Haller 62ca873ddd Bump gocui 2024-08-17 10:25:16 +02:00
Stefan Haller 32cfe7a5c3 Bump gocui 2024-06-28 08:14:05 +02:00
Stefan Haller db0a1586d9 Highlight inactive selection in bold
An inactive selection is one where the view is part of the context stack, but
not the active view. For example, the files view when you enter the staging
panel, or any view when you open a panel.
2024-06-23 14:43:13 +02:00
Stefan Haller 9eb9b369ff Bump gocui 2024-06-23 11:54:01 +02:00
Stefan Haller 6a6316cfb6 Use model searching in commits (and sub-commits) view 2024-06-23 11:43:12 +02:00
Stefan Haller 2c9bca8b57 Return errors from blameDeletedLines instead of just logging them
I guess when I originally wrote this code I just didn't know how to do that...
2024-06-01 08:31:18 +02:00
Karim Khaleel b98ae1c773 Add default lazygit config generator for Config.md from JSON schema 2024-05-19 14:08:05 +02:00
Jesse Duffield 9124d8dbaa Bump go version to 1.22 2024-05-19 16:38:21 +10:00
Stefan Haller 7270dea48d Switch git-todo-parser from fsmiamoto original repo to stefanhaller's fork
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-22 20:59:15 +02:00
Stefan Haller 9f8ae76189 Bump gocui
In Gui.onWorker we only make the minimum possible change to get things to
compile after the API-breaking change of the gocui update; we'll make this
cleaner later in this branch.
2024-04-18 10:10:30 +02:00
Stefan Haller 8487bc397d Remove our yaml fork
Switch back to the official go-yaml package.
2024-03-29 17:55:06 +01:00
Stefan Haller 99ad6005e8 Bump gocui 2024-03-09 10:00:07 +01:00
Stefan Haller 212ec7e8e5 Bump gocui
This resolves the regression from the last gocui bump that strikethrough no
longer worked.
2024-03-03 18:41:03 +01:00
Stefan Haller ad0394aebe Bump gocui
The main change here is to bump tcell to v2.7.1, which should fix problems with
multibyte characters on Windows.
2024-03-01 14:07:19 +01:00
Ching Pei Yang 2118ecdf8e Switch to github.com/adrg/xdg 2024-02-18 15:36:56 +01:00
Stefan Haller 57ac9c2189 Bump required go version to 1.21
We'll need this to use the slices.Sort function in the next commit. It would
also be possible to use sort.Ints instead, but it's slower.
2024-02-16 13:51:15 +01:00
Jesse Duffield f9e8428061 Use slimmer scrollbars
The previous scrollbars were too chunky and encroached too much on a view's content.

The new ones are slim and right-aligned so they encroach into dead space between views
which is much better
2024-01-30 08:44:03 +11:00
Jesse Duffield 24a4302c52 Add range selection ability on list contexts
This adds range select ability in two ways:
1) Sticky: like what we already have with the staging view i.e. press v then use arrow keys
2) Non-sticky: where you just use shift+up/down to expand the range

The state machine works like this:
(no range, press 'v') -> sticky range
(no range, press arrow) -> no range
(no range, press shift+arrow) -> nonsticky range
(sticky range, press 'v') -> no range
(sticky range, press arrow) -> sticky range
(sticky range, press shift+arrow) -> nonsticky range
(nonsticky range, press 'v') -> no range
(nonsticky range, press arrow) -> no range
(nonsticky range, press shift+arrow) -> nonsticky range
2024-01-19 10:47:21 +11:00
Stefan Haller cb5d0bca1c Bump gocui
... and switch back from stefanhaller's tcell fork to the official tcell. This
basically reverts 7ccb871a45.
2024-01-10 09:39:25 +01:00
Stefan Haller a46f26e148 Bump gocui 2023-12-09 15:23:40 +01:00
Karim Khaleel df5b3693d6 Add invopop/jsonschema fork 2023-12-02 10:46:24 +01:00
Stefan Haller 58971182ca Fix go.mod file (go-difflib dependency should be indirect)
This broke with commit 7af371701d, but nobody noticed yet.
2023-11-18 16:01:03 +01:00
Jesse Duffield c74448f00d Don't select current search result when showing search status
Previously there was no way to render a view's search status without also moving the cursor
to the current search match. This caused issues where we wanted to display the status
after leaving the view and coming back, or when beginning a new search from within the
view.

This commit separates the two use cases so we only move the cursor when we're actually
selecting the next search match
2023-09-25 16:37:59 +10:00
Stefan Haller b6c892a08a Provide a simple way to debug an integration test 2023-09-11 08:17:58 +02:00
Stefan Haller 917eb88617 Bump gocui 2023-09-09 09:44:50 +02:00
Stefan Haller ebdfd8046a Bump gocui 2023-08-15 11:40:40 +02:00
Simon Whitaker ed1547e0cb Add a Click() primitive to the integration test library 2023-08-07 15:10:28 +01: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 92f0aa23cc Remove file watcher code
Now that we refresh upon focus, we can scrap this file watching code.
Stefan says few git UIs use file watching, and I understand why: the
reason this code was problematic in the first place is that watching
files is expensive and if you have too many open file handles that
can cause problems.

Importantly: this code that's being removed was _already_ dead.
2023-08-02 21:50:44 +10:00
Stefan Haller c5acbb6c7c Bump gocui 2023-08-02 11:35:36 +02:00
Stefan Haller 4aca854b59 Point tcell at stefanhaller's fork
This is temporary as long as https://github.com/gdamore/tcell/pull/599 is not
merged. Once that PR is merged, we can revert this.
2023-08-02 11:35:36 +02:00
Jesse Duffield 975d2bedb6 Remove secureexec package
From the go 1.19 release notes:

Command and LookPath no longer allow results from a PATH search to be found relative to the current directory. This removes a common source of security problems but may also break existing programs that depend on using, say, exec.Command("prog") to run a binary named prog (or, on Windows, prog.exe) in the current directory. See the os/exec package documentation for information about how best to update such programs.
2023-07-30 19:59:51 +10:00
Jesse Duffield 2d4706e96e fix go mod 2023-07-30 18:36:04 +10:00
Jesse Duffield 7b302d8c29 Write unit tests with the help of afero
Afero is a package that lets you mock out a filesystem with an in-memory filesystem.
It allows us to easily create the files required for a given test without worrying about
a cleanup step or different tests tripping on eachother when run in parallel.

Later on I'll standardise on using afero over the vanilla os package
2023-07-30 18:35:36 +10:00
Stefan Haller deecbadda9 Fix the x/exp dependency
We started to use it directly in 429225da80.
2023-07-29 10:01:41 +02:00
hatredholder 75674d819c bring back yaml library fork 2023-07-26 12:50:39 +03:00
Jesse Duffield 8637587b82 Better word wrap
Word wrapping has been pretty bad so far so let's fix that.
2023-07-23 11:43:10 +10:00
Jesse Duffield 866e0a618b Add integration test for accordion mode 2023-07-19 22:17:29 +10:00
Jesse Duffield be02786dad Fix accordion issue
This fixes the issue in accordion mode where the current line wasn't in the viewport upon focus.

It doesn't perfectly fix it: the current line always appears at the top of the view. But it's good enough
to cut a new release. The proper fix is to only focus the line after the view has had its height adjusted.
2023-07-19 20:39:10 +10:00
Jesse Duffield 6b9390409e Use an interface for tasks instead of a concrete struct
By using an interface for tasks we can use a fake implementation in tests with extra methods
2023-07-10 17:12:21 +10:00
Jesse Duffield 14ecc15e71 Use first class task objects instead of global counter
The global counter approach is easy to understand but it's brittle and depends on implicit behaviour that is not very discoverable.

With a global counter, if any goroutine accidentally decrements the counter twice, we'll think lazygit is idle when it's actually busy.
Likewise if a goroutine accidentally increments the counter twice we'll think lazygit is busy when it's actually idle.
With the new approach we have a map of tasks where each task can either be busy or not. We create a new task and add it to the map
when we spawn a worker goroutine (among other things) and we remove it once the task is done.

The task can also be paused and continued for situations where we switch back and forth between running a program and asking for user
input.

In order for this to work with `git push` (and other commands that require credentials) we need to obtain the task from gocui when
we create the worker goroutine, and then pass it along to the commands package to pause/continue the task as required. This is
MUCH more discoverable than the old approach which just decremented and incremented the global counter from within the commands package,
but it's at the cost of expanding some function signatures (arguably a good thing).

Likewise, whenever you want to call WithWaitingStatus or WithLoaderPanel the callback will now have access to the task for pausing/
continuing. We only need to actually make use of this functionality in a couple of places so it's a high price to pay, but I don't
know if I want to introduce a WithWaitingStatusTask and WithLoaderPanelTask function (open to suggestions).
2023-07-09 21:30:19 +10:00
Jesse Duffield 631cf1e873 Bump gocui
This includes new gocui logic for tracking busy/idle program state
2023-07-08 22:26:28 +10:00
Jesse Duffield 1a36cb9f3f
View filtering (#2680) 2023-07-03 12:57:11 +10:00
Jesse Duffield 4df353d006 Bump gocui 2023-07-02 15:47:04 +10:00
Gustavo Krieger 87fe30d50d Bump git-todo-parser 2023-07-02 02:07:32 -03:00
Jesse Duffield 4ff02bd3b7 Add integration test for commit highlighting on focus
A better refactor would be to allow matchers to assert against either a string or a slice of cells, so that I could have
the same ergonomics that I have elsewhere, but this is a start.
2023-06-01 22:20:30 +10:00
Jesse Duffield 33789d67f0
Merge pull request #2490 from jesseduffield/dependabot/go_modules/golang.org/x/net-0.7.0 2023-05-30 17:56:18 +10:00
Jesse Duffield cc0edd42bb
Merge pull request #2508 from Ryooooooga/remove-jesseduffield-yaml 2023-05-30 17:39:25 +10:00