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.51k stars 570 forks source link

Backspace moves cursor to new line #1873

Open maver1ck opened 5 years ago

maver1ck commented 5 years ago

Versions

ConEmu build: 19.03.10 x64 OS version: Windows Version 10.0.17763 Build 17763 x64 Used shell version (Far Manager, git-bash, cmd, powershell, cygwin, whatever): Ubuntu 18.04 + bash + zsh + oh-my-zsh

Problem description

Backspace key is moving cursor to newline when the line is too long

Everything working correctly on standard terminal (bash.exe)

stty -a
speed 38400 baud; rows 41; columns 213; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc

Steps to reproduce

  1. Have long command
  2. Use backspace key

Actual results

Before backspace image

After backspace image

Expected results

Chars are removed. No cursor in new line

Maximus5 commented 5 years ago

How do you start your shell?

maver1ck commented 5 years ago

Task is default: exec zsh from within bash and then enabling oh-my-zsh plugins.

.zshrc

export ZSH="/home/maverick/.oh-my-zsh"
ZSH_THEME="agnoster"
ENABLE_CORRECTION="true"
COMPLETION_WAITING_DOTS="true"
plugins=(git git-extras pip python aws common-aliases debian docker kubectl zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh

Way to reproduce it in my env: 1) Run new shell 2) cat bigger file (for example .bashrc) 3) use up arrow to find longer command 4) backspace will be messed up

Maximus5 commented 5 years ago

Task is default

Please don't cut down words. "Default" to you is unclear and ambiguous to me

prophess commented 5 years ago

Hi,

i have the same issue. It works fine in normal bash mode and zsh mode in wsl ubuntu.

if i use conemu with wsl with bash and then start profile it to zsh enviroment its ok in the beginning. When the directory is a git project with long directory names and i press "backspace". A new line is opened instead of deleting the characters.

But zsh environment is running correctly with normal ubuntu wsl shell without conemu. I think it has to with the shell size in conemu maybe. I dont know.

But..

i want to use conemu, i think it is the best emulator i tried! ;-)

thanks in advance, prophess

prophess commented 5 years ago

Hi,

i have the same issue. It works fine in normal bash mode and zsh mode in wsl ubuntu.

if i use conemu with wsl with bash and then start profile it to zsh enviroment its ok in the beginning. When the directory is a git project with long directory names and i press "backspace". A new line is opened instead of deleting the characters.

But zsh environment is running correctly with normal ubuntu wsl shell without conemu. I think it has to with the shell size in conemu maybe. I dont know.

But..

i want to use conemu, i think it is the best emulator i tried! ;-)

thanks in advance, prophess

Found a issue with the linesize, if i set it to 80 i dont have the problems. if i add more than 80 or do fullscreen i have the same problem described above.

prophess commented 5 years ago

Hi, i have the same issue. It works fine in normal bash mode and zsh mode in wsl ubuntu. if i use conemu with wsl with bash and then start profile it to zsh enviroment its ok in the beginning. When the directory is a git project with long directory names and i press "backspace". A new line is opened instead of deleting the characters. But zsh environment is running correctly with normal ubuntu wsl shell without conemu. I think it has to with the shell size in conemu maybe. I dont know. But.. i want to use conemu, i think it is the best emulator i tried! ;-) thanks in advance, prophess

Found a issue with the linesize, if i set it to 80 i dont have the problems. if i add more than 80 or do fullscreen i have the same problem described above.

Ok first i thought linesize, but know i think the problem is the tab key, with autocompletion in zsh. if i switch to the git directory with normal cd, i had no problems. If i use tab, problem with backspace exists. Have to check zsh with tab completion

prophess commented 5 years ago

Ok i fixed my environment, it was a problem with my .zsh_profile. conemu works great.

maver1ck commented 5 years ago

What's the fix ?

kcbanner commented 5 years ago

I'm also interested in the fix for this, I've gone over my zsh config and don't see any issues

Teiron commented 5 years ago

I fixed it on my side by switching font that I used to Literation Mono Powerline from Consolas. Hope that helps

ziggythehamster commented 4 years ago

I have this problem as well. Here's how my task is configured:

set MSYSTEM=MINGW64 & set "PATH=D:\MSYS2\usr\bin;%PATH%" & %ConEmuBaseDirShort%\conemu-msys2-64.exe /usr/bin/zsh --login -i

and I also use oh-my-zsh, here's relevant parts from .zshrc:

POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status time)
COMPLETION_WAITING_DOTS="true"
DISABLE_UNTRACKED_FILES_DIRTY="true"
ZSH_THEME="powerlevel9k/powerlevel9k"
plugins=(git zsh-syntax-highlighting)
ziggythehamster commented 4 years ago

I should also add that it only actually screws up with something pasted or with something in my history that is kind of long

ziggythehamster commented 4 years ago

That's not accurate, sorry. I just made it happen by typing berks and using my arrow keys to scroll through history matching berks, finding the first one, and pressing backspace. The line was just berks update foodb, so quite short. I'm running latest oh-my-zsh and latest plugins as well, and pacman -Syuu is fully up to date.

systocrat commented 4 years ago

@prophess It'd be great if you could come back and document your fix

prophess commented 4 years ago

@prophess It'd be great if you could come back and document your fix

Hi, i dont remember it :( i switched to hyper, for me it was a little bit faster in some cases. please try to fix the .zsh_profile, maybe there was a bug.. sorry.

best regards, prophess

BimmerTom commented 4 years ago

I had this same issue and (for now) my fix was to uncheck "Compress long strings to fit space" under the font settings in the General section. I hope this helps.

Prunoideae commented 4 years ago

I had this same issue but the solutions above are not working, I tried for multiple times, and found some other strange issues that may be helpful to the final solution.

I lanuched the WSL with wsl:bash, but since I'm using WSL2, the command actually being executed is: set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & wsl.exe -cur_console:pm:/mnt

When typing too long and cause the problem happened, extending the width causes the terminal sometimes to print a newline, or showing in original line, with a character deleted, hit backspace multiple times will have the right amount of characters deleted, so it's should just be something wrong in the visualization.

A too long text (It just happens if the input string is too long image

Before resizing: image

After resizing: image

Also, the maximum length that cmder works without wrong is actually determined by the total length of segment and the text input.

image

This maybe involve some length calculation of special characters of powerline font, since I found that cd into a git direcory will made the length decrease, what I think should be constant before.

image

The two text both cause the bug happened, but the length is different, the lower one accepts the same text like the upper one without bug.

Resizing the width to a smaller one is being complex and behaves different in different situations.

If the width is able to include the text in one line, it works just like what happened if the width is extended: image

but if the width causes the text was broken into two lines, the line will be print again like above, but the problem will not appear if you delete the characters of new line, the problem was delayed until returning to the first line, making the cursor stopped. image

If resize the window width below the valve length, the problem will not happen. image

As far as I can figure out, this problem may involve how zsh and the cmder process the text and cache, but since I have little knowledge of this field, I can't produce a clear solution, hope this comment will produce some useful information.

Dyllaann commented 4 years ago

I also have this problem. All mentioned fixes above are not working. Running ConEmu 191012, (latest alpha as of writing) on Microsoft Windows [Version 10.0.19041.208]

upya4ko commented 4 years ago

Have same problem, ConEmu 191012, bash on remote server over ssh running from WSL debian.

set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl --distro-guid={GUID} -C~ -cur_console:pm:/mnt
ziggythehamster commented 4 years ago

Something I'm noticing is that we all seem to have ZSH_THEME="powerlevel9k/powerlevel9k". I can make this happen reliably:

image

If I type a 5 and then backspace, it will ALWAYS go to a new line - even if I copy-paste the whole string.

Things I have tried to no effect:

Here is my .zshrc, if it helps:

export ZSH="/home/keith/.oh-my-zsh"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir_writable dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
ZSH_THEME="powerlevel9k/powerlevel9k"
DISABLE_MAGIC_FUNCTIONS=true
COMPLETION_WAITING_DOTS="true"
DISABLE_UNTRACKED_FILES_DIRTY="true"
plugins=(git zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh

My task command looks like this (I'm SSHing to a virtual machine):

set MSYSTEM=MINGW64 & set "PATH=D:\MSYS2\usr\bin;%PATH%" & %ConEmuBaseDirShort%\conemu-msys2-64.exe ssh keith@keith-p920-gentoo

This only seems to happen if my scrollback buffer (set to 32766) is full. I see that #1960 is a similar issue, and the suggestion there was to uncheck "Inject ConEmuHk" under Features. This seems to fix my problem, even with a full scrollback buffer.

Hopefully that's enough information to reproduce it yourself :)

upya4ko commented 4 years ago

uncheck "Inject ConEmuHk" under Features. This seems to fix my problem, even with a full scrollback buffer.

Confirm! Disable "Inject ConEmuHk" (Settings -> Featurs -> In-console options) fix problem in my case!

Dyllaann commented 4 years ago

I have to unconfirm. Unchecking Inject ConEmuHk did not resolve my issue :(

ziggythehamster commented 4 years ago

@Dyllaann That checkbox won't affect any currently open tabs; you have to open a new one for it to take effect. Are you saying that unchecking that doesn't resolve it on a new tab?

Dyllaann commented 4 years ago

Yep! Even tried restarting the whole program. Unfortunately still no success :(. I can reproduce it easily and the behaviour is exactly the same after unchecking the option and making new tab (or new Cmder instance).

ziggythehamster commented 4 years ago

And I can now confirm that disabling ConEmuHk does not work, either.... and I'm able to reproduce it on line 188 of my scrollback, rather than the end.

This is very, very strange.

Dyllaann commented 4 years ago

Is there any update on this? Any information that I can provide? It is still happening on 200713 alpha and it's extremely annoying to work with.

Besides jumping to a new line, sometimes the console gets stuck and doesnt allow any input or output.

Maximus5 commented 4 years ago

There are too many notes in this issue. Hard to track.

To resume:

Correct?

Dyllaann commented 4 years ago

To answer most of your questions:

To add something; I'm not sure if this is fully similar, but sometimes general output gets cut off, causing the terminal to get stuck. I will post a screenshot of what this looks like as soon as it will happen again. For example, when SSH'ing into a machine, it will print some default output like system load, disk usage, memory usage etc. Halfway during this print, it will randomly stop and the console will freeze. Forcing me to shut down this terminal, open up a new one and attempt again.

Maximus5 commented 4 years ago

As you don't use connector, the -cur_console:p1 it's not required and may cause bad things. Generally, when you run wsl.exe such wear, ConEmu doesn't process ANSI, all things are done by conhost. And that means all bugs comes from conhost too.

Dyllaann commented 4 years ago

Is there any way where I can let ConEmu process the ANSI too then?

Maximus5 commented 4 years ago

Connector+wslbridge, but this was broken by WSL2.

Well, some users report in gh-1930 that wslbridge2 is working, but I'm not going to include it in ConEmu. My goal is to get rid of wslbridge completely.

As for me, running wsl.exe in ConEmu without bridge or -cur_console:p1 should work for now.

ziggythehamster commented 4 years ago

This does it for me in MSYS2 zsh, MSYS2 SSH with a remote Bash, and MSYS2 SSH with a remote zsh. Unchecking ConEmuHk doesn't fix it for me.

Maximus5 commented 4 years ago

For msys2 shells you should use connector

MichaelJCole commented 3 years ago

For me, the fix was Settings -> Startup -> Tasks -> {bash::ubuntu} and change the big edit box to say %windir%\system32\bash.exe ~ Removing the cur_console:p did the trick.

nathanieltagg commented 2 years ago

uncheck "Inject ConEmuHk" under Features. This seems to fix my problem, even with a full scrollback buffer.

Confirm! Disable "Inject ConEmuHk" (Settings -> Featurs -> In-console options) fix problem in my case!

This solved my issue as well.

jonberenguer commented 2 years ago

After doing some tests with the new windows terminal, installing the new terminal and setting it as the default terminal might be a better fix. Just make sure you explicitly dedicate either the integrated or discrete in the windows setting and not let windows automatically choose.

alelom commented 1 year ago

Just confirming that the problem still exists, and that I could remove it by disabling "Inject ConEmuHk" (Settings -> Features -> In-console options). My startup task: "wsl.exe" --cd "/home/alelom/repos".

tripodcreative commented 2 weeks ago

I can confirm this problem exists. Deleting characters creates new lines and you are unable to see where exactly you're typing - pretty much renders nano unusable. I will test the step above from @alelom and see if it works.

dovereem commented 1 week ago

Had the same issue (windows, conemu (in cmder), WSL2). Disabling ConEmuHk and opening a new console fixed the issue for me