MSYS2 bash: Cursor display doesn't follow arrow keys after running Emacs #3791

Closed
opened 2026-01-30 23:30:11 +00:00 by claunia · 11 comments
Owner

Originally created by @andreaszapf on GitHub (Sep 8, 2019).

Environment

Windows build number: [10.0.18362.295]
Windows Terminal version (if applicable): 0.4.2382.0

Any other software?

MSYS2 / MINGW64:

  $ uname -srvo
  MINGW64_NT-10.0-18362 3.0.7-338.x86_64 2019-07-11 10:58 UTC Msys

  $ bash --version
  GNU bash, version 4.4.23(1)-release (x86_64-pc-msys)

Emacs from MSYS2's mingw64/mingw-w64-x86_64-emacs package:

  (emacs-version)
  "GNU Emacs 26.2 (build 1, x86_64-w64-mingw32)
   of 2019-06-03"

Steps to reproduce

  • Run MSYS2 / MINGW64 bash in Windows Terminal, e.g. in a CMD tab with
    set MSYSTEM=MINGW64&& c:\msys64\usr\bin\bash --login -i

  • Run Emacs in the terminal (emacs -nw) and quit it immediately

  • Back at the bash prompt, enter a few characters, say 123

  • Press the left-arrow as often as needed to move the cursor to the
    beginning of the line (in this example 3 times)

  • Enter some other characters

Expected behavior

  • The cursor moves with the left-arrow keystrokes to the beginning of the line

  • New text appears line start

Actual behavior

  • The cursor stays at the end of the line, although the internal position is updated
    and new text appears at line start.

  • When I delete text using Backspace or Delete, the cursor jumps to the correct position,
    but jumps back to the end of line when new text is entered.

It seems that MINGW Emacs and MSYS2 bash don't play well in Windows Terminal -- in
the classic Windows console there is no issue.

This might be related to #2561.

Originally created by @andreaszapf on GitHub (Sep 8, 2019). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: [10.0.18362.295] Windows Terminal version (if applicable): 0.4.2382.0 Any other software? MSYS2 / MINGW64: $ uname -srvo MINGW64_NT-10.0-18362 3.0.7-338.x86_64 2019-07-11 10:58 UTC Msys $ bash --version GNU bash, version 4.4.23(1)-release (x86_64-pc-msys) Emacs from MSYS2's mingw64/mingw-w64-x86_64-emacs package: (emacs-version) "GNU Emacs 26.2 (build 1, x86_64-w64-mingw32) of 2019-06-03" ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> - Run MSYS2 / MINGW64 bash in Windows Terminal, e.g. in a CMD tab with `set MSYSTEM=MINGW64&& c:\msys64\usr\bin\bash --login -i` - Run Emacs in the terminal (`emacs -nw`) and quit it immediately - Back at the bash prompt, enter a few characters, say `123` - Press the left-arrow as often as needed to move the cursor to the beginning of the line (in this example 3 times) - Enter some other characters # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> - The cursor moves with the left-arrow keystrokes to the beginning of the line - New text appears line start # Actual behavior <!-- What's actually happening? --> - The cursor stays at the end of the line, although the internal position is updated and new text appears at line start. - When I delete text using Backspace or Delete, the cursor jumps to the correct position, but jumps back to the end of line when new text is entered. It seems that MINGW Emacs and MSYS2 bash don't play well in Windows Terminal -- in the classic Windows console there is no issue. This might be related to #2561.
Author
Owner

@zadjii-msft commented on GitHub (Sep 9, 2019):

@andreaszapf Does this repro in emacs in WSL for you as well, or only the MSYS2 emacs?

@zadjii-msft commented on GitHub (Sep 9, 2019): @andreaszapf Does this repro in emacs in WSL for you as well, or only the MSYS2 emacs?
Author
Owner

@andreaszapf commented on GitHub (Sep 9, 2019):

@zadjii-msft Emacs in WSL works fine for me. That is, Emacs 25.3.1 on an older WSL (let me know if you need the exact version).

@andreaszapf commented on GitHub (Sep 9, 2019): @zadjii-msft Emacs in WSL works fine for me. That is, Emacs 25.3.1 on an older WSL (let me know if you need the exact version).
Author
Owner

@zadjii-msft commented on GitHub (Sep 9, 2019):

Good to know - that means it's specific to the Terminal's VT processing, and not a broader issue with conpty. Thanks for confirming!

@zadjii-msft commented on GitHub (Sep 9, 2019): Good to know - that means it's specific to the Terminal's VT processing, and not a broader issue with conpty. Thanks for confirming!
Author
Owner

@zadjii-msft commented on GitHub (Jan 29, 2020):

@andreaszapf I know that this a long shot, but is this still repro'ing for you? I just tried installing the 20190524 MSYS2 build locally, and this doesn't seem to repro on the 0.8.10091.0 build of the Windows Terminal anymore. I thought I had a fix in #4372 for this, but since it's not even occurring in 0.8, then maybe it was fixed by something else earlier.

@zadjii-msft commented on GitHub (Jan 29, 2020): @andreaszapf I know that this a long shot, but is this still repro'ing for you? I just tried installing the 20190524 MSYS2 build locally, and this doesn't seem to repro on the 0.8.10091.0 build of the Windows Terminal anymore. I thought I had a fix in #4372 for this, but since it's not even occurring in 0.8, then maybe it was fixed by something else earlier.
Author
Owner

@andreaszapf commented on GitHub (Jan 29, 2020):

@zadjii-msft It's still reproducing for me, I just checked with a fresh MSYS2 install like the one you used (msys2-x86_64-20190524).

Here is what I did step-by-step, after installing MSYS2, in a CMD tab in Terminal:

C:\>set MSYSTEM=MINGW64&& c:\msys64\usr\bin\bash --login -i
$ pacman -S -q --noconfirm mingw64/mingw-w64-x86_64-emacs
$ emacs -nw --eval '(save-buffers-kill-terminal)' # open and immediately close emacs
$ abcde
# cursor can't be moved with arrow keys...
@andreaszapf commented on GitHub (Jan 29, 2020): @zadjii-msft It's still reproducing for me, I just checked with a fresh MSYS2 install like the one you used (msys2-x86_64-20190524). Here is what I did step-by-step, after installing MSYS2, in a CMD tab in Terminal: ```shell C:\>set MSYSTEM=MINGW64&& c:\msys64\usr\bin\bash --login -i $ pacman -S -q --noconfirm mingw64/mingw-w64-x86_64-emacs $ emacs -nw --eval '(save-buffers-kill-terminal)' # open and immediately close emacs $ abcde # cursor can't be moved with arrow keys... ```
Author
Owner

@zadjii-msft commented on GitHub (Jan 29, 2020):

Well that's no good. Doing the exact same thing works fine on my machinetm
image

Maybe this will just go away in the next version with #4372 🤞

@zadjii-msft commented on GitHub (Jan 29, 2020): Well that's no good. Doing the exact same thing _works fine on my machine_<sup>tm</sup> ![image](https://user-images.githubusercontent.com/18356694/73405813-86bb6600-42ba-11ea-9276-360e56e00cfd.png) Maybe this will just go away in the next version with #4372 🤞
Author
Owner

@andreaszapf commented on GitHub (Jan 30, 2020):

Maybe this will just go away in the next version with #4372 🤞

Seems like it does 😁 -- I finally got around to building Terminal from source (which worked flawlessly 👏), and I'm seeing the issue on master but not on the #4372 branch.

Looking forward to the next release!

@andreaszapf commented on GitHub (Jan 30, 2020): > Maybe this will just go away in the next version with #4372 🤞 Seems like it does :grin: -- I finally got around to building Terminal from source (which worked flawlessly :clap:), and I'm seeing the issue on `master` but not on the #4372 branch. Looking forward to the next release!
Author
Owner

@zadjii-msft commented on GitHub (Jan 30, 2020):

Oh that's great to hear! I'll tag this up appropriately then. Thanks for taking the time to build this and confirm!

@zadjii-msft commented on GitHub (Jan 30, 2020): Oh that's great to hear! I'll tag this up appropriately then. Thanks for taking the time to build this and confirm!
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 30, 2020):

I'm .. actually unfortunately still seeing this with 0.9.301.0, which does contain #4372. It trivially reproduces if I hide the cursor and then try to move around my prompt line as well. :/

@DHowett-MSFT commented on GitHub (Jan 30, 2020): I'm .. actually unfortunately still seeing this with 0.9.301.0, which does contain #4372. It trivially reproduces if I hide the cursor and then try to move around my prompt line as well. :/
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 30, 2020):

Oh, I see. I'm using 25l instead of 12l. Interesting. WT should be hiding the cursor on 25l. Okay. This is just a different issue. 😄

@DHowett-MSFT commented on GitHub (Jan 30, 2020): Oh, I see. I'm using `25l` instead of `12l`. _Interesting._ WT should be hiding the cursor on 25l. Okay. This is just a different issue. :smile:
Author
Owner

@ghost commented on GitHub (Feb 13, 2020):

:tada:This issue was addressed in #4372, which has now been successfully released as Windows Terminal Preview v0.9.433.0.🎉

Handy links:

@ghost commented on GitHub (Feb 13, 2020): :tada:This issue was addressed in #4372, which has now been successfully released as `Windows Terminal Preview v0.9.433.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.9.433.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#3791