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 572 forks source link

Problems while navigating through command history #2316

Open eblis opened 3 years ago

eblis commented 3 years ago

Versions

ConEmu build: 210422 x64 OS version: Windows 10 20H2 x64 Git version: 2.24.0.windows.1 click version: v0.4.9 [git:2fd2c2]

Problem description

I have some problems navigating through history, especially after just finishing a command. For example I might run git status and want to press up twice to get the previous command, but instead I get weird characters like [A, [D, etc.

Steps to reproduce

  1. Write a command in the terminal, echo test
  2. Write another command in the terminal echo another test
  3. Press up key to navigate to previous commands

Actual results

Instead of seeing actual commands that I've run i see [A, [D, [B, etc. If I delete the characters and press up multiple times I start seeing commands again (first times I press up nothing seems to happen, i still see the [A character, but if I keep at it i eventually see the commands I've typed.)

Expected results

I should only see the commands I've executed

Additional files

ghost commented 3 years ago

Maybe not related, using 210422 build I've also had the "strange" chars when trying to pop history (UP arrow key) after running some external (not shell) commands, for eg. forfiles.exe. These weird chars only happen if I press UP arrow in a short time after executing the command, 2-3 seconds or so, if I wait longer last history line will be fine. This does not happen with before build 210314, so maybe try that one too or just wait long enough (yeah, this not a solution) :) From what I've read has to do with some timeout when ConEmu changes back from Xterm. With 210314 the bug(feature?) also happens, but only if I press UP right about the time the command finishes or while runs... still annoying, but much less (not having to wait seconds after like in last build)

eblis commented 3 years ago

Hmm, now that you mention it i remember seeing the the problem with the previous build as well. It's like you said, when you press the UP arrow quickly enough you get the weird chars. It's a problem when running long lived commands, as I may want to browse through history while the command finishes running and then I end up with the weird stuff

sysfsss commented 3 years ago

I'm able to reproduce this issue pretty reliably by running ls -al, and then pressing Up then Return to rerun ls -al once or a few times. After that point, the cursor keys insert ANSI escape codes, e.g. [A [B [C [D.

Maximus5 commented 3 years ago

You have not specified the shell you are using. Do you use cygwin connector? What's about clink, why it was mentioned?

eblis commented 3 years ago

I'm using normal windows command prompt (not powershell). I do not use cygwin connector. I thought that maybe click was important, maybe was responsible somehow and that's why i mentioned it

Maximus5 commented 3 years ago

Please enable Terminal modes in the StatusBar and check when that happens. Try to disable the clink.

I've tried to reproduce, but on my PC the proper "W" state in terminal modes is not changed to "X". So I need more details on how to reproduce.

eblis commented 3 years ago

When it's in mode WK it works as expected, pressing up gives me the previous command(s). image

When it's in mode XK that's when the problem occurs. image

When I run a command (like the ls -la mentioned above) the terminal modes switch from WK to XK for a time, if I press up while it's switched to XK that's when I get the ANSI escape codes.

I had clink installed globally, not just for ConEmu and once I disabled it then the terminal always stays in W mode, it no longer switches to X mode and I cannot reproduce the problem anymore.

Digging deeper it seems like the problem is with some powerline clink lua scripts I installed, if I disable them (i start clink without them) then the problem doesn't occur. I believe i installed them from here

ghost commented 3 years ago

Environment: ConEmu portable ConEmuPack.210422.7z Windows 10 (2004)

Test: unpack portable ConEmu, nothing else, no clink, etc, and run forfiles.exe mode changes from W to X and doesn't change back immediately (3 secs or so), during this time will give escape codes

https://user-images.githubusercontent.com/28786798/120204507-9261c880-c231-11eb-8e7d-313963e3272b.mp4

I've tried this in Win 7 too, there works as should (mode changes imediately), so in my case only 10 exhibits this

eblis commented 3 years ago

I can also get the issue to occur without clink with forfiles like @ianmatt mentioned above.

drwtsn32x commented 3 years ago

Normally Terminal mode shows as "W" on my systems. On one system if I run ping.exe, terminal mode changes to "X". If I CTRL+C out of ping, it takes a few seconds for terminal mode to switch back to "W". During this time I cannot navigate the history.

Strangely, on another system ping.exe does NOT trigger the change in terminal mode. Not sure why. Same Windows version on both (10 21H1), same shell (Powershell.exe), etc.

drwtsn32x commented 3 years ago

With every update in the preview channel I get excited...hoping for this bug to be fixed....but so far remain disappointed! Still affected by this annoying bug.

jahsen commented 3 years ago

I have a similar problem when i clear the console. After clearing, history shows [A [B.. Not sure if this helps for the solution but yes, it is annoying.