Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Character persistence on cmder windows #506

Closed
ctexlive opened this issue May 26, 2015 · 35 comments
Closed

Character persistence on cmder windows #506

ctexlive opened this issue May 26, 2015 · 35 comments
Labels

Comments

@ctexlive
Copy link

Character persistence occurs when residual character of a previous command remains visible on the screen.
When press up-arrow key to view the last command, "mplayer" for example, the Command Window display is ok. See Fig1.
cmder1

Subsequently press down-arrow key to change command history, some character remains visible on the CMDER windows.See Fig2.
cmder2

It is very annoying. How to resolve the problem? Thanks.
It should be noted that the number of a command is less than or equal to 4,the phenomenon would not occur again.
Fig3 is font setting.
font setting

@terry-fei
Copy link

me too

1 similar comment
@henumohe
Copy link

henumohe commented Jul 1, 2015

me too

@denis-adobe
Copy link

This error is not replicable for me

@xgenvn
Copy link

xgenvn commented Apr 18, 2016

Same here, struggling for at least 6 months, after windows 10 upgrade.
To reproduce this bug:

  1. Type some long commands (>5 length of characters)
  2. Ctrl-C
  3. Arrow-Up
  4. Arrow-Down
    There's should be a first character of last command stay on screen.
    I'm on latest version of cmder. Change the codepage to utf-8 wont help.
    This bug is only happening on CMD. Under bash shell everything is fine.

@iainheng
Copy link

Having the same problem here in Windows 10

@xgenvn
Copy link

xgenvn commented May 10, 2016

I have searched around again of any solution for this bug, and it's turned out that changing the {lambda} to proper ascii character will help (under cmder/config/cmder.lua). Check again #553.

@Jackbennett
Copy link
Contributor

I can't reproduce this on my 1.3.0-pre can more people try it please.

@Asinin3
Copy link

Asinin3 commented Dec 3, 2016

I'm still getting this error in the latest version.

@emmanuelnk
Copy link

emmanuelnk commented Jan 1, 2017

Have this error on latest version 161206 ... My system locale is Chinese (Simplified). Changing the lambda character in clink.lua file to an ascii one (like '>') worked and the error disappeared. When I changed my system locale back to English (US) (I'm based in China so I had it set to GBK Simplified Chinese), the lambda non-ascii works.

@ghost
Copy link

ghost commented Jan 4, 2017

Same issue here

It looks like the character 'λ' have different character width based on code page

For example:
01

@Justsoos
Copy link

Justsoos commented Oct 25, 2017

same problem, replace all, just two lambda "λ" in file \cmder\vendor\clink.lua with "$", solved.

if env == nil then
    lambda = "$"
else
    lambda = "("..env..") $"
end

@MadLittleMods
Copy link

The new location seems to be \cmder\config\cmder.lua (ConEmu v161206)

function lambda_prompt_filter()
    clink.prompt.value = string.gsub(clink.prompt.value, "{lamb}", "$")
end

@hulucc
Copy link

hulucc commented Oct 21, 2018

Same issue, locale is Chinese simplified.

@jdhao
Copy link

jdhao commented Nov 15, 2018

I am using the latest version of cmder (version 1.3.8). It seems that this old issue still persists. The clink.lua file have changed. Find the line

    local lambda = "λ"

and replace it with

    local lambda = "$"

Restart cmder and the problem should disappear.

@Justsoos
Copy link

@jdhao
the replace method was for version 1.3.4 older, like screenshot
image
I tried cmd ver 1.3.8 and ComEmu ver 180626[64] just now, have not encontered this bug again.
and no more running the environment:
set LANG=zh_CN.UTF8

@hulucc
Copy link

hulucc commented Nov 19, 2018

Still not working after updated 1.3.8

@Justsoos
Copy link

@hulucc I tried ver1.3.8 as new installation, yes, the bug still there, my solution:
changing the "λ" with "$" at line 43.
image

@daxgames
Copy link
Member

You guys keep calling this a bug but I can't reproduce it. If we can't reproduce it and you keep masking it by just changing it to $ it will never get fixed as you guys seem to want based on the recent comments.

If someone can find a root cause and tell us how to reproduce it might be looked at but until that happens no one on the Cmder team is trying to 'fix' it.

@daxgames
Copy link
Member

If you do want to just mask it there are better ways than changing the clink.lua because this file is overwritten on upgrade.

@Justsoos
Copy link

@daxgames ha~ those bugs often met with Non-English Windows by chcp and UTF and font ... so many mixed mistakes, like:
#1339
#764
#1171

and "lambda" is not a normal ascii code, and most bugs from M$ Windows, not within capabilities of cmder.... so cmder run like a patch bbs of M$

@emmanuelnk
Copy link

emmanuelnk commented Nov 22, 2018

@daxgames it's very easy to reproduce. Change the system locale of your system to something like Chinese Simplified. Then open cmder and write a bunch of commands. Then try to use the 'up' key to view previous commands. That should reproduce the issue. It's probably something to do with the byte size of the lambda character in different encodings.

@jdhao
Copy link

jdhao commented Nov 22, 2018

@daxgames , I will try to elaborate my possibly-related settings for you to reproduce this bug.

I am using Windows 10 Pro, Version 1803 and OS build 17134.345. My region is set as China and my language is set English (United States).

I am using Cmder version 1.3.8 with ConEmu 180626. My settings for Startup -> Environment is

set PATH=%ConEmuBaseDir%\Scripts;%PATH%
set LANG=en_US.utf8
chcp utf-8
set TERM=xterm-256color

Please let me know if you need any further info.

@Justsoos
Copy link

Justsoos commented Nov 22, 2018

@jdhao @daxgames , I did not set certain chcp or utf in cmder settings, with win10 enterprise 1803, and with font and charset:

image

image

run chcp:
image

and I DID NOT change the lua file, Chinese and lambda is all right with cmder ver1.3.8.

@jdhao
Copy link

jdhao commented Nov 22, 2018

@Justsoos , You have to type long command (some say the command length must be longer than four ) to actually trigger this bug. Have you tried long commands?

@Justsoos
Copy link

53

@daxgames
Copy link
Member

daxgames commented Nov 22, 2018

@Justsoos are you using the up arrow to cycle through history as others have mentioned? And then backspacing to the beginning of the line?

@Justsoos
Copy link

@daxgames it is a complex story.... before update to 1.3.8, I run an 1.3.4 probably, have to set LANG=zh_CN.UTF8 and chage the lambda to $ and several things else to avoid Chinese charactor errors, but this time, I delete the old cmder and extract 1.3.8 to the default install directory, have not to change them that mentioned, all works well.

@dorkbox
Copy link

dorkbox commented Mar 28, 2020

An update on this issue, since I'm having it as well...
I think it's absolutely a rendering issue... since you cannot have arbitrary characters as the "lambda". For example - the default is λ and if you replace it with 𝝺 (which is a different lambda) - the prompt is completely screwed up

image

For reference, I got that lambda from https://en.wikipedia.org/wiki/Lambda, and it is the U+1D77A lambda. I have UTF support enabled in windows.Only the first two lambda's work from that page. (and they screw up with command history navigation)

@hamzahamidi
Copy link

I'm facing the same issue with v1.3.14

@dorkbox
Copy link

dorkbox commented May 13, 2020

The only solution, sadly, is to change the character. ~ is what I use, and works without issues.

@jdhao
Copy link

jdhao commented Oct 16, 2020

@daxgames It is year 2020. Sadly, this issue still persists. If this issue is hard to fix, why not just change the default prompt character from lambda to something purely ASCII, for example, > or $ or whatever?
I am curious to know what is the rationale to still use this lambda character.

@daxgames
Copy link
Member

@jdhao it's not up to me. This is not my project I just help maintain it. Changing the prompt is user configurable by adding lua code to the config folder. You can change it to whatever you want one time and you will never have to change it again.

@AaronFeledy
Copy link

AaronFeledy commented Jun 18, 2021

This issue has been plaguing me in my git-for-windows bash shell. If the last item in my history was longer than 4 characters, the first character would stick. I noticed that a fresh install was not having this issue, so I went digging.

I initially narrowed it down to my bash starting without the --login option. Removing the --login from a fresh install caused the problem to occur there. Adding the --login to my broken configuration fixed the issue for me. In digging through the various scripts that run for the login shell, I was able to determine that it was setting the LANG environment variable in the /etc/profile.d/lang.sh script.

export LANG=$(exec /usr/bin/locale -uU)

Manually running export LANG=en_US.UTF-8 would immediately fix a problematic shell prompt for me.

I'm not sure how this translates to those experiencing the issue with cmd, but it likely has something to do with locale options and perhaps something in init.bat that handles setting locale config.

@jackusay
Copy link

If you find out you can't change Prompt symbol (lambda λ), here is one possible solution.

v1.3.1

C:\cmder\vendor\git-for-windows\etc\profile.d\git-prompt.sh:

change

  PS1="$PS1"'λ '                 # prompt: always λ 

into

  PS1="$PS1"'$ '                 # prompt: always $ 

@chrisant996
Copy link
Contributor

Or use UTF8 as the system code page.

The problem is that CJK locales define some Unicode characters to be different widths than the standard says they should be. And also some fonts define the characters with different widths than the standard or CJK widths expect.

Lambda happens to be one of the affected characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests