Skip to content
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

Some vi key bindings will not work after running lazygit #7853

Cokile opened this issue Mar 22, 2021 · 5 comments

Some vi key bindings will not work after running lazygit #7853

Cokile opened this issue Mar 22, 2021 · 5 comments
bug Something that's not working as intended


Copy link

Cokile commented Mar 22, 2021

Fish Version:
fish, version 3.2.1

Operating System:
MacOS 10.15.7
Darwin MacBook-Pro.local 19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64

iTerm2 build 3.4.4

set fish_key_bindings fish_user_key_bindings


function fish_user_key_bindings
    # map jk to Esc
    bind -M insert jk "if commandline -P; commandline -f cancel; else; set fish_bind_mode default; commandline -f backward-char force-repaint; end"

Steps to reproduce:

  1. Install lazygit via Homebrew
$ brew install lazygit
  1. Run lazygit
$ lazygit
  1. Quit lazygit

Before running lazygit, all vi key bindings work as expected. But after running lazygit, some vi key bindings will not work:

  1. cw, dw: just moving the cursor to the beginning of the next word, no characters will be deleted.
  2. jk: just outputting the jk rather than switching to normal mode. But if press j only, nothing will appear, it seems fish is still waiting the subsequent input.
Copy link

zanchey commented Mar 23, 2021

After running lazygit in, even without vi bindings, fish is not behaving normally. Pressing right arrow works the first few times, then starts spitting [C (the tail end of the escape sequence) out to the terminal.

No differences in the stty -a output before or after.

@zanchey zanchey added the bug Something that's not working as intended label Mar 28, 2021
@zanchey zanchey added this to the fish-future milestone Mar 28, 2021
Copy link

ridiculousfish commented Mar 30, 2021

This is curious. Some one is configuring fish as the receiving process for signals when some fd becomes readable (via O_ASYNC). This sends SIGIO on every select() on stdin, thus fish thinks it is constantly being interrupted, which breaks multi-character key bindings including cw and arrow keys.

No file descriptor in the fish process has O_ASYNC set, so maybe there is some funny behavior where lazygit sets it and then fish inherits the behavior? Not sure, it's strange.

ridiculousfish added a commit that referenced this issue Apr 4, 2021
If fish launches a program and that program marks stdin as O_ASYNC, then
fish will start receiving SIGIO events on Mac. This occurs even though
the file descriptor itself does not have the O_ASYNC flag set.

SIGIO is reported as interrupting select which then breaks multiple-key
bindings, especially in vi-mode.

As the SIGIO based universal notifier is disabled, remove it and the
SIGIO handler itself. This allows fish to ignore properly ignore SIGIO.

Fixes #7853
@ridiculousfish ridiculousfish modified the milestones: fish-future, fish 3.2.2 Apr 4, 2021
Copy link

@zanchey note I cherry-picked this into 3.2.2 as 797fbbb

Copy link

zanchey commented Apr 4, 2021

Many thanks!

Copy link

Cokile commented Apr 7, 2021

Thanks for the awesome work. BTW, I upgraded Lazygit to the latest release(v0.27), which replace termbox package with tcell, and the issue seems have gone.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
bug Something that's not working as intended
None yet

No branches or pull requests

3 participants