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.64k stars 581 forks source link

Cursor position bug when using double width character with WSL #2408

Open ironsand opened 2 years ago

ironsand commented 2 years ago

Problem description

When using double width character with WSL, ConEmu doesn't remember right position of cursor like the GIF below.

wsl

This is what I stroke. あ[left cursor]abcd[backspace][backspace][backspace][backspace]

This bug doesn't occur when I use WSL with Command Prompt, neither when I use cmd.exe or PowerShell with ConEmu.

In settings Monospace is unchecked.

Versions

ConEmu build: 210912 [64] OS version: Windows 10 Pro x64 Used shell version: WSL2 (Ubuntu) Kernel version: 5.4.72

Maximus5 commented 2 years ago

I tried to reproduce your steps and it works properly on my side.

2022-01-01-16-53-24

Setting "Monospace" does not affect the input, where I see the bug in your case.

I don't know the exact versions of your Windows and WSL but from your screencast, it's clear that "bcd" are not inserted in the prompt but kinda overwritten in the place of "a". That's already an input bug - ConEmu just shows what is there in the RealConsole. And after deletion of the "abcd" (which are not in your prompt for some reason), the cursor goes leftward leaving the garbage. And again, that is not a ConEmu fault, if you show the RealConsole (Ctrl+Win+Alt+Space) I believe you'll see the same problem there.

My conclusion for now - the bug is not in ConEmu but somewhere else. Maybe it's a problem with PS1, maybe conhost related.

https://conemu.github.io/en/wsl.html

ironsand commented 2 years ago

Thanks for the explanation, I was not aware of the difference between cmd.exe and conhost.exe. I confirmed that RealConsole has the same strange behavior.

I tried reproduce the bug from conhost by the following steps, but the cursor moved properly.

  1. Win + R
  2. type conhost.exe
  3. type wsl.exe
  4. use double width characters

I thought maybe the behavior caused by my settings. So I reinstalled a portable version ConEmu and run wsl.exe in cmd.exe, but still the input behaves strangely.

This is my Windows version.

Edition Windows 10 Pro
Version 21H2
Installed on    ‎2021/‎03/‎16
OS build    19044.1415
Experience  Windows Feature Experience Pack 120.2212.3920.0

I'll post if I can find out what is causing the error.