powerline-go icon indicating copy to clipboard operation
powerline-go copied to clipboard

Bash wrapping issue on Debian 10 container

Open ankitbko opened this issue 4 years ago • 25 comments

image

As you can see in the container the wrapping does not happen. It works in Ubuntu based container fine.

Use this docker image to reproduce the issue FROM mcr.microsoft.com/dotnet/core/sdk:3.1. https://hub.docker.com/_/microsoft-dotnet-core-sdk?tab=description

ankitbko avatar May 28 '20 05:05 ankitbko

Have the same issue though it only seems to happen sometimes. Not sure what the trigger is

andrzejnovak avatar May 28 '20 07:05 andrzejnovak

In the Debian container? Happened to me always.

ankitbko avatar May 28 '20 14:05 ankitbko

I am having this problem with Win10 using the new terminal

andrzejnovak avatar May 29 '20 11:05 andrzejnovak

@andrzejnovak Are you using powershell? It works fine for bash on WSL 2 using the new Terminal.

ankitbko avatar May 29 '20 15:05 ankitbko

@ankitbko Nah using bash, same problem also using hyper

andrzejnovak avatar Jun 01 '20 20:06 andrzejnovak

Same issue on arch linux.

thousandtyone avatar Sep 03 '20 20:09 thousandtyone

Thus seems to be an issue with your Terminal emulator, as neither the IntelliJ emulator, Konsole, iTerm, Gnome Terminal, xTerm, nor the linux tty console have issues with this.

justjanne avatar Oct 02 '20 05:10 justjanne

It occurs on Konsole in Manjaro Linux (Arch based). If I set the default Linux prompt the issue doesn't occur, so it's not a Terminal issue. This is my prompt : PS1="$(/usr/bin/powerline-go -cwd-max-depth 4 -modules user,cwd,git,venv,jobs,exit,root -error $?)"

theravengod avatar Nov 10 '20 09:11 theravengod

Started happening again on a new Linux VM with containors in it. Any idea on how to debug this?

ankitbko avatar Jan 25 '21 23:01 ankitbko

This is caused by wrong length calculation of special characters (e.g. U+E0B0 ).

Here's a hacky fix:

# ~/.bashrc

function _update_ps1() {
    PS1="$($GOPATH/bin/powerline-go -newline -error $?)"
    # add the following line
    PS1="${PS1//$'\356\202\260'/$'\[$(tput sc)\] \[$(tput rc)\356\202\260\]'}"
    # or more intuitive
    # PS1="${PS1///'\[$(tput sc)\] \[$(tput rc)\]'}"
}

eternalphane avatar May 06 '21 05:05 eternalphane

@eternalphane looked promising for a moment, but it doesn't solve it for me

andrzejnovak avatar May 09 '21 15:05 andrzejnovak

Ya didn't work for me either. But maybe the root cause is regarding wrong length calculation. Is there a generic solution for this?

ankitbko avatar May 09 '21 15:05 ankitbko

@andrzejnovak @ankitbko ~~maybe you should check the output of printf "%q\n" "$GOPATH/bin/powerline-go -newline -error $?" (or whatever in your .bashrc) to find the actual issue in your case.~~ Alright, finally found a promising solution: set LC_ALL to C.UTF-8 (or make sure LC_CTYPE is utf-8 locale). Maybe this should be added to the doc.

eternalphane avatar May 10 '21 09:05 eternalphane

I can't reproduce the issue, but this is a known issue with prompt length / window size. I would try looking at https://unix.stackexchange.com/questions/105958/terminal-prompt-not-wrapping-correctly

dswij avatar May 10 '21 10:05 dswij

@dswij can I see your output of locale? I just want to confirm if it's related to locale settings.

eternalphane avatar May 10 '21 10:05 eternalphane

@dswij can I see your output of locale? I just want to confirm if it's related to locale settings.

UTF-8

dswij avatar May 10 '21 11:05 dswij

UTF-8

Just checked with a fresh installed Debian 10 in Hyper-V, the default LC_ALL is empty. Then I'm wondering why my LC_ALL is assigned a value...😕

eternalphane avatar May 10 '21 11:05 eternalphane

Changing the LC_ALL doesn't seem to affect this for me

andrzejnovak avatar May 10 '21 13:05 andrzejnovak

Changing the LC_ALL doesn't seem to affect this for me

@andrzejnovak what's the output of test=''; echo ${#test} on your machine?

eternalphane avatar May 10 '21 14:05 eternalphane

@eternalphane 1

andrzejnovak avatar May 10 '21 14:05 andrzejnovak

@andrzejnovak emmm... I have no idea what's happening on your side

eternalphane avatar May 10 '21 15:05 eternalphane

Changing the LC_ALL doesn't seem to affect this for me

@andrzejnovak what's the output of test=''; echo ${#test} on your machine?

Mine also shows 1

ankitbko avatar May 10 '21 15:05 ankitbko

This happens for me on Fedora 34 with bash. No containers involved. Happens with xfce4-terminal and gnome-terminal.

Looks to be a bug with the termtitle module. If I don't enable that in my -modules ... list, I no longer experience the bug.

codewest avatar Aug 02 '21 22:08 codewest

any solution ?, im having this issue also

gabrielfsousa avatar Oct 06 '21 19:10 gabrielfsousa

The "hacky fix" kindly provided by @eternalphane worked for me.

ashleyghooper avatar Feb 24 '24 00:02 ashleyghooper