Skip to content

LazyGit exits unpredictably while moving quickly through commits (on WSL only) #622

Open

Description

@treefitty

Describe the bug
When I move the cursor (up/down keys) through the commits (reflog) the app crashes. This only happens on WSL, not on my Mac (that works perfectly). Strangely the problem seems to happen less if I use the '-d' debug flag.

To Reproduce
Steps to reproduce the behavior:

  1. Open lazygit in any repository directory in WSL
  2. Use left/right arrows to move focus to the commits pane
  3. Quickly use the up/down keyboard keys to shift focus. While I haven't been able to confirm this, it might be a race condition because some change sets are quite large.

Expected behavior
It should move focus without exiting.
I say "exit" because I get no logs in the console.. so it may not be a "crash" per se.

Desktop (please complete the following information):

  • Windows 10 WSL (Microsoft Windows [Version 10.0.18363.592])
  • Lazygit Version: commit=, build date=2020-01-10, build source=debian, version=0.13, os=linux, arch=amd64
  • ConEmu 191012 [64] Startup Info

Additional context
It may be worth noting that I use "ConEmu" too, so it could be some strangely confluence of circumstances.

Activity

  1. carstengehling commented on Feb 11, 2020

    @carstengehling
    Sponsor

    Same bug at my machine, also with ConEmu (Cmder). I just tried the exact same interactions while using the default "bash console". And in this setup lazygit does not exit. So I am coming to the conclusion, that ConEmu is doing something weird. I'll look more into it.

  2. jesseduffield commented on Feb 14, 2020

    @jesseduffield
    Owner

    would either of you happen to have a stack trace of the error, assuming it panics on exit? The fact that the debug flag has an impact tells me it's a concurrency issue and that maybe we need to put a mutex on something.

  3. jesseduffield commented on Feb 14, 2020

    @jesseduffield
    Owner

    I've got a PR up that may fix the issue: let me know if it works :) #643

  4. carstengehling commented on Feb 18, 2020

    @carstengehling
    Sponsor

    would either of you happen to have a stack trace of the error, assuming it panics on exit?

    It does not seem to panic - just exit. Unless there is somewhere in WSL where I could look for a logfile?

    Thanks for the possible bugifx, I'll try to see if I can build the PR today and test it.

  5. saulery commented on Mar 26, 2020

    @saulery

    Hello, Same error there. Typing LEFT, RIGHT, UP, DOWN, PGUP, PGDOWN exits the program.

    I use ConEmu and gitbash on Windows 7 64 bits SP1.

    No stack trace, he just exits.

    But in case of typing PGUP, the program exits and displays one tilde.
    Sometimes typing UP exits and displays the character A.
    Sometimes typing RIGHT exits and displays the character C.

    conemu_keys_options

  6. jesseduffield commented on Aug 24, 2020

    @jesseduffield
    Owner

    I think I know what's going on: in terminal speak the up key is typically translated into ESC+A, and right is translated into ESC+C. So I think that after pressing a key the terminal is sending an escape sequence to the program but not fast enough to be interpreted as a single escape sequence, meaning it's taken as a literal escape key which therefore exits the program. The details probably differ but that's the gist I'm assuming.

    I wonder if it's something to do with the value of the TERM variable. What do you get doing echo $TERM (assuming echo is a command windows recognises) @lkppo @carstengehling @paulcarroll

  7. treefitty commented on Aug 24, 2020

    @treefitty
    Author

    That sounds really promising @jesseduffield
    Unfortunately i've completely moved from windows to mac recently and can't find that out 🤕 .... perhaps you have some insight @carstengehling ?

  8. cseickel commented on Jan 4, 2021

    @cseickel

    I am having the same problem, using WSL in ConEmu on Windows 10. I am running this in tmux if that makes a difference.

    echo $TERM outputs: screen-256color

  9. jesseduffield commented on Apr 6, 2021

    @jesseduffield
    Owner

    @carstengehling @lkppo @cseickel could you guys try this out on the latest release? We're using a new rendering library which may fix the issue

  10. carstengehling commented on Apr 8, 2021

    @carstengehling
    Sponsor

    @jesseduffield I switched away from ConEmu ~8 months ago to use MS' own Windows Terminal instead. I have not experienced any of the above-mentioned problems since.

  11. carstengehling commented on Apr 8, 2021

    @carstengehling
    Sponsor

    On that note: Lazygit works awesomely with Windows Terminal! I have just upgraded to 0.27.1 (using your PPA), and everything is just so smooth. Mouse integration - including scrolling with the mouse wheel - is just plain cool. :-)

  12. Universal-Invariant commented on Oct 27, 2026

    @Universal-Invariant

    Similar problems. I installed Conemu recently and tried lazygit and all kinds of problems making it useless. Never any problems with windows terminal. If I run lazygit outside a git and it pops up most recent I end up seeing 24;25; type of sequences that are constantly played "in the filter". I guess these are ANSI escape code's. If I disable ansi and xterm from features in conemu it works better but random keys seem to be sent or detected by lazygit.

    I noticed the mode was WK, I went to xterm and it went back to flooding the the input (see image). I then selected windows W mode only and best I can tell it seems to be working.

    When starting lazygit it start sets ConEmu to XABK mode and that seems to be the real problem.

    Image

    AI: "You don’t have to turn K mode off for every program — it only matters for applications that rely on the application‑cursor (DECCKM) key sequences. Most Windows console programs (cmd, PowerShell, etc.) work fine with K mode enabled, but many terminal user interfaces (TUIs) that were written for a plain XTerm‑style terminal (like lazygit, vim, htop, ncdu, etc.) interpret those extra sequences as stray keystrokes.

    So:

    If you only use TUI tools that don’t care about DECCKM, you can leave K mode on and it won’t affect them.
    If you run a TUI that expects plain XTerm input (as lazygit does), K mode will cause the “random key” behaviour. Disabling K mode for that specific tab (or launching the program with -new_console:p1) resolves the issue without harming other console applications.
    In short, you don’t need a global K‑mode disable; just start the affected TUI (e.g., lazygit) in W mode only. All other console programs will continue to work as before."
    "

    chrisant996/clink#722

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions