Maximus5 / ConEmu

Customizable Windows terminal with tabs, splits, quake-style, hotkeys and more
https://conemu.github.io/
BSD 3-Clause "New" or "Revised" License
8.55k stars 571 forks source link

Possible regression: Some keys not working with MSYS2 Bash #1465

Open JonathanHolvey opened 6 years ago

JonathanHolvey commented 6 years ago

Versions

ConEmu build: 171109, 180206 (x64) OS version: Windows 7 x64 Shell: MSYS2 Bash, Git Bash

Problem description

Until recently I have been using ConEmu build 161206, however I recently upgraded to take advantage of the bundled cygwin/msys terminal connector in later versions.

I'm using Bash from MSYS2, and after upgrading to build 171109 or 180206, the Ctrl+Backspace combination only deletes a single character. In build 161206, this key combination deletes the whole word to the left of the cursor.

When using the default connector task for MSYS2 I noticed that other keys have issues as well.

I've used identical configuration between all three versions, including the default settings and the same ConEmu.xml file. Since I'm only changing the build of ConEmu I'm using, I am guessing that there is a regression in later builds causing this bug.

If it is a configuration problem, I'd be grateful for assistance to resolve it.

Steps to reproduce

  1. Download and extract build 171109 of ConEmu
  2. Open ConEmu with default settings
  3. Create a new task {{Bash}} with the command bash
  4. Start the new {{Bash}} task or the default {{Bash::Msys2-x64}} task
  5. Type some words and use the keys below

Actual results (build 171109)

Task name Keys Result
{{Bash}} Ctrl+Backspace One character is deleted to the left of the cursor
{{Bash::Msys2‑x64}} Backspace Characters are deleted from buffer, but the cursor moves to the right, and the deleted characters are still visible
{{Bash::Msys2‑x64}} , Nothing happens

Expected results (build 161206)

Task name Keys Result
{{Bash}} Ctrl+Backspace One word is deleted to the left of the cursor
{{Bash::Msys2‑x64}} Backspace One character is deleted to the left of the cursor (not tested in build 161206)
{{Bash::Msys2‑x64}} , The cursor moves left and right, respectively (not tested in build 161206)
Maximus5 commented 6 years ago

https://conemu.github.io/en/SettingsKeyboard.html#id2526

JonathanHolvey commented 6 years ago

Thanks for your reply. I looked through my settings and the Read line enhancements Ctrl+Backspace option is already checked. I tried disabling and re-enabling it, but that didn't help.

Here is a dump of my settings file: https://pastebin.com/AhrtnkFh

dima-ringba commented 6 years ago

@Maximus5 Not sure if that's directly related, but navigation using arrow keys does not work in FAR under Windows 10 64 bit (ConEmu preview build 180429). Actually, a lot of keys don;t work properly, including all F1-F12 keys. Instead every key press gets converted into a letter sequence in FAR. Let me know if I should log a new issue for this - I saw some keyboard-related bug reports, so not sure if you are already looking in this direction.

Maximus5 commented 6 years ago

@dima-ringba Far is Windows console application utilizing WinAPI. Just don't turn on xterm in Far consoles!!

Maximus5 commented 6 years ago

@JonathanHolvey To get full featured terminal for bash you should use connector.

cygwin/msys connector

Recreate default tasks.

dima-ringba commented 6 years ago

@Maximus5 I see, didn't know about xterm mode at all until now. Thanks!

JonathanHolvey commented 6 years ago

Today I downloaded the latest preview build, 180506, however I still can't get it working as expected.

My usual configuration modified to run conemu-msys2-64.exe instead of bash (and some additions to .inputrc) works with everything except Ctrl+Backspace, which deletes only a single character.

What's the minimum required setup to get this working? I tried deleting my entire config and only setting up the following:

This gives me the same broken behaviour as my original post.

Maximus5 commented 6 years ago

So you only have problems with Ctrl+BS? This is general and well known Unix pty issue. Just google for keymappings for your inputrc.

You may check what ConEmu sends by showkeys -a.

JonathanHolvey commented 6 years ago

I don't think it's an inputrc problem. Using versions 161206 and 180506 for comparison, Ctrl+Backspace works in Bash in version 161206 after enabling read line enhancements, whereas in version 180506 it does not. All other settings are defaults.

What do you think has changed?

I don't have showkeys, but using Ctrl+V in Bash outputs ^? in version 180506, but does nothing in version 161206. I assume that the read line enhancements setting causes ConEmu to hijack the Ctrl+Backspace keypress, and for some reason, this is not working with Bash in later versions (it is still effective with cmd).

Maximus5 commented 6 years ago

Don't assume, but check https://conemu.github.io/en/KeyEvents.html#key-reader

JonathanHolvey commented 6 years ago

KeyEvents outputs the following for Ctrl+Backspace in both versions of ConEmu (161206 and 180506):

18:52:23 KEY_EVENT_RECORD: Dn, 1, Vk="VK_CONTROL" [17/0x0011], Scan=0x001D uChar=[U=' ' (0x0000): A=' ' (0x00)]
         Ctrl=0x00000028 (Casac - ecNs) (Windowed)
18:52:23 KEY_EVENT_RECORD: Dn, 1, Vk="VK_BACK" [8/0x0008], Scan=0x000E uChar=[U=' (0x0008): A=' (0x08)]
         Ctrl=0x00000000 (casac - ecns) (Windowed)
18:52:23 KEY_EVENT_RECORD: Up, 1, Vk="VK_CONTROL" [17/0x0011], Scan=0x001D uChar=[U=' ' (0x0000): A=' ' (0x00)]
         Ctrl=0x00000020 (casac - ecNs) (Windowed)
Maximus5 commented 6 years ago

Not KeyEvents, but key-reader as my link says. There are precompiled binaries on GitHub

With KeyEvents you may see, that there were no differences between versions.

Maximus5 commented 6 years ago

Sample output

$ ./kr-cyg32.exe
Starting raw conin reader, press Ctrl+C to stop
<x1F><x7F>

<x1F> was Ctrl+BS, and <x7F> just BS.

Maximus5 commented 6 years ago

And mintty. ConEmu bahavior is the same.

2018-05-24_13-02-53

JonathanHolvey commented 6 years ago

Thanks for the pointer to the pre-compiled key-reader binaries.

In ConEmu 161206 and 180506 I get <x7F> for both Backspace and Ctrl+Backspace.

ConEmu with conemu-msys2-64.exe gives <x7F> and <x1F>, however normal backspace and arrow keys don't work, as per my original post.

It seems there are two issues here:

  1. The change of behaviour between 161206 and 180506 with Ctrl+Backspace in Bash
  2. Arrow and backspace keys not working with the MSYS2 connector
Maximus5 commented 6 years ago

In ConEmu 161206 and 180506 I get for both Backspace and Ctrl+Backspace

Without connector?

Arrows (at least) are working properly for me and many others. So