-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add support for suspending LazyGit with Ctrl+Z on Unix systems #4757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@stefanhaller Iβve addressed the earlier issues you pointed out. Iβm not sure if a test is needed for this change, or if there are any other steps youβd expect before merging. Let me know! π |
@cowboy8625 The behavior is still the same for me, as described in #3906 (comment). After typing bg, I get the "+ suspended (tty output)" error, and then (We had a similar problem back when we used And finally, when I use Until these problems are solved I don't feel we can merge this. But I'm also not sure how much time is justified for putting into this, to be honest. |
@stefanhaller I was able to better handle the issue where running Hereβs how it looks now on macOS (Kitty terminal):![]() And hereβs how Neovim behaves:![]() I also resolved the issue that happened when running via Previously, I was only sending a stop signal to the lazygit process itself, which doesnβt work properly if itβs launched inside a wrapper or Thanks a lot for your help! |
Nice, seems like we're getting somewhere with this. π I had to make quite a few changes, and I took the opportunity to also restructure the commits to make them reviewable. I didn't want to force-push your master branch, so I pushed a new branch A few notes about what I changed:
During testing I still had one or two cases where lazygit didn't come back to the foreground after typing |
Yeah, this is a lot cleaner. |
@stefanhaller Am I good to open this up for review? π |
I'd say so, yes. I'll hold off merging this for now until after we released 0.54.1, which I expect to happen tomorrow or the day after; that's a hotfix (needed because of #4793), and I don't want to include any other changes there. To be honest I don't really fully understand what we're doing here when we wake up, like what this But it seems to work well, so I'm fine with going with this for now. |
To my knowledge this is the most reliable way to handle it. By opening |
- Remove old-style build tags (the +build syntax has become obsolete with 1.17) - Remove redundant build tags from '*_windows.go' files
This should have been removed in 8c574f8, where I renamed it back to 'gui' to fix a linter warning.
This frees up ctrl-z for suspend. Hopefully, redo is not such a frequently used operation that the change annoys people. Co-authored-by: Stefan Haller <[email protected]>
These suspend/resume the gocui layer and pause/unpause background refreshes.
Co-authored-by: Stefan Haller <[email protected]>
@cowboy8625 Merging this at last. I rebased onto master for you to get rid of the "megred-from-master" commits that result in a very ugly commit history. For future PRs, please never merge master into a branch, always rebase onto master instead, thanks. |
@cowboy8625 It seems we still have some sort of race condition here. Today I typed ctrl-z (just to check), and when typing Would be really nice if we could make this more robust, but without a better reproduction recipe there may not be much we can do. Just letting you know. |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [jesseduffield/lazygit](https://github.com/jesseduffield/lazygit) | minor | `v0.54.2` -> `v0.55.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>jesseduffield/lazygit (jesseduffield/lazygit)</summary> ### [`v0.55.0`](https://github.com/jesseduffield/lazygit/releases/tag/v0.55.0) [Compare Source](jesseduffield/lazygit@v0.54.2...v0.55.0) <!-- Release notes generated using configuration in .github/release.yml at v0.55.0 --> #### What's Changed ##### Enhancements π₯ - Allow filtering the keybindings menu by keybinding by [@​stefanhaller](https://github.com/stefanhaller) in [#​4821](jesseduffield/lazygit#4821) - Add support for suspending LazyGit with Ctrl+Z on Unix systems by [@​cowboy8625](https://github.com/cowboy8625) in [#​4757](jesseduffield/lazygit#4757) - Add "CopyToClipboard" command to `ConfirmationController` by [@​kyu08](https://github.com/kyu08) in [#​4810](jesseduffield/lazygit#4810) - Add a user config for using git's external diff command for paging by [@​stefanhaller](https://github.com/stefanhaller) in [#​4832](jesseduffield/lazygit#4832) - Log the hash of dropped stashes by [@​stefanhaller](https://github.com/stefanhaller) in [#​4850](jesseduffield/lazygit#4850) ##### Fixes π§ - Fix right-alignment of divergence from base branch for branch checked out in a worktree by [@​stefanhaller](https://github.com/stefanhaller) in [#​4824](jesseduffield/lazygit#4824) - Support Azure DevOps vs-ssh.visualstudio.com SSH remotes as hosting provider by [@​Kahitar](https://github.com/Kahitar) in [#​4822](jesseduffield/lazygit#4822) - Improve display of "esc" keybinding in the keybindings status bar by [@​stefanhaller](https://github.com/stefanhaller) in [#​4819](jesseduffield/lazygit#4819) - Use external diff command in stashes panel by [@​stefanhaller](https://github.com/stefanhaller) in [#​4836](jesseduffield/lazygit#4836) - Remove the git.paging.useConfig option by [@​stefanhaller](https://github.com/stefanhaller) in [#​4837](jesseduffield/lazygit#4837) - Don't auto-forward branches that are checked out in another worktree by [@​stefanhaller](https://github.com/stefanhaller) in [#​4833](jesseduffield/lazygit#4833) - Fix dropping range selection of filtered stashes by [@​stefanhaller](https://github.com/stefanhaller) in [#​4849](jesseduffield/lazygit#4849) - Fix rare crash in interactive rebase (merge command without comment) by [@​stefanhaller](https://github.com/stefanhaller) in [#​4872](jesseduffield/lazygit#4872) - Make it possible to rebind the Confirm keybinding by [@​stefanhaller](https://github.com/stefanhaller) in [#​4860](jesseduffield/lazygit#4860) ##### Maintenance βοΈ - Pass only Git-tracked Go files to gofumpt by [@​kyu08](https://github.com/kyu08) in [#​4809](jesseduffield/lazygit#4809) - Update donation wording so that it's clear there's no strings attached by [@​jesseduffield](https://github.com/jesseduffield) in [#​4827](jesseduffield/lazygit#4827) - Enhance MR/Issue templates readability by [@​kyu08](https://github.com/kyu08) in [#​4829](jesseduffield/lazygit#4829) - Run label check workflow only on label events and open pr event by [@​kyu08](https://github.com/kyu08) in [#​4830](jesseduffield/lazygit#4830) ##### Docs π - Add installation with gah by [@​marverix](https://github.com/marverix) in [#​4820](jesseduffield/lazygit#4820) - docs(VISION): fix "Dicoverability" typo by [@​Rudxain](https://github.com/Rudxain) in [#​4866](jesseduffield/lazygit#4866) - Add dev container feature as installation method to README by [@​HenningLorenzen-ext-bayer](https://github.com/HenningLorenzen-ext-bayer) in [#​4876](jesseduffield/lazygit#4876) ##### I18n π - Update translations from Crowdin by [@​stefanhaller](https://github.com/stefanhaller) in [#​4873](jesseduffield/lazygit#4873) #### New Contributors - [@​marverix](https://github.com/marverix) made their first contribution in [#​4820](jesseduffield/lazygit#4820) - [@​Kahitar](https://github.com/Kahitar) made their first contribution in [#​4822](jesseduffield/lazygit#4822) - [@​cowboy8625](https://github.com/cowboy8625) made their first contribution in [#​4757](jesseduffield/lazygit#4757) - [@​Rudxain](https://github.com/Rudxain) made their first contribution in [#​4866](jesseduffield/lazygit#4866) - [@​HenningLorenzen-ext-bayer](https://github.com/HenningLorenzen-ext-bayer) made their first contribution in [#​4876](jesseduffield/lazygit#4876) **Full Changelog**: <jesseduffield/lazygit@v0.54.2...v0.55.0> </details> --- ### Configuration π **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). π¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. β» **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. π **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45Ny40IiwidXBkYXRlZEluVmVyIjoiNDEuOTcuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
β¨ Add Ctrl+Z suspend support for LazyGit on Unix-like systems
π Summary
This PR adds support for suspending LazyGit when the user presses
Ctrl+Z
, making it behave like common CLI tools (e.g., Vim, less, htop):Ctrl+Z
sends aSIGTSTP
signal to suspend LazyGit.fg
, LazyGit redraws and continues working without hanging.β Motivation
Make LazyGit feel more native on Unix-like systems by supporting standard terminal suspend/resume (Ctrl+Z / fg) behavior.
go generate ./...
)Closes #3906