Closed tkf0 closed 1 year ago
Interesting, could you please provide the output of 'echo $PS1' and 'locale'? This looks a bit like issues I saw when locale was set to 'C.UTF-8'
Sure!
pi@pi51 ~ last: 0m 0s 19:54:09
➜ echo $PS1
\n\[\e[38;5;251m\]\[\e[48;5;8m\] pi@pi51 \[\e[38;5;8m\]\[\e[48;5;31m\]\[\e[38;5;15m\]\[\e[48;5;31m\] ~ \[\e[38;5;31m\]\[\e[49m\]\[\e[39m\]\[\e[49m\] \[\e[39m\]\[\e[38;5;250m\]\[\e[38;5;238m\]\[\e[48;5;250m\] last: 0m 0s \[\e[38;5;250m\]\[\e[38;5;8m\]\[\e[38;5;251m\]\[\e[48;5;8m\] 19:54:09 \[\e[38;5;8m\]\[\e[39m\]\[\e[49m\]\n\[\e[38;5;250m\]\[\e[49m\] ➜ \[\e[39m\]\[\e[49m\]
pi@pi51 ~ last: 0m 0s 19:54:13
➜ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
pi@pi51 ~ last: 0m 0s 19:54:23
➜
So nothing wrong with locale at least. And these two characters are 'start of heading' and 'start of text', I'm not quite sure why the terminal is trying to print them though. And the way it appears before the output of every command is weird. This doesn't happen with a normal prompt?
No, if I remove the 2 relevant lines from my .bashrc, i.e. disable sbp, I don't see these characters anymore
hm, I don't have any windows machines available unfortunatly so I'm going to have to rely on some help debugging this. Adding the help wanted lable.
I am seeing the same in my elementary OS.
Same happens in WSL1 one for me. I am not sure which information would help or how to debug this further. I am using JetBrains Mono and Nerd Fonts and when using the same settings in the VSCode terminal everything works like a charm. I assume that the WSL terminal can't render the arrow.
➜ echo $PS1
\n\[\e[38;5;251m\]\[\e[48;5;8m\] sandro \[\e[38;5;8m\]\[\e[48;5;31m\]\[\e[38;5;15m\]\[\e[48;5;31m\] ~ \[\e[38;5;31m\]\[\e[48;5;148m\]\[\e[38;5;238m\]\[\e[48;5;148m\] ~1\[\e[39m\] \[\e[38;5;238m\]\[\e[39m\] \[\e[38;5;238m\]master \[\e[38;5;148m\]\[\e[49m\]\[\e[39m\]\[\e[49m\] \[\e[39m\]\[\e[38;5;250m\]\[\e[38;5;238m\]\[\e[48;5;250m\] last: 0m 0s \[\e[38;5;250m\]\[\e[38;5;8m\]\[\e[38;5;251m\]\[\e[48;5;8m\] 12:48:25 \[\e[38;5;8m\]\[\e[38;5;22m\]\[\e[38;5;250m\]\[\e[48;5;22m\] 🌧 +16°C ↘11km/h 0.0mm \[\e[38; 5;22m\]\[\e[39m\]\[\e[49m\]\n\[\e[38;5;250m\]\[\e[49m\] ➜ \[\e[39m\]\[\e[49m\]
sandro ~ ~1 master last: 0m 0s 12:49:02
➜ locale
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
I see it too on Windows using the Windows Terminal app with the git-bash shell and connecting to a Ubuntu 18.04 host. I see two emoticons.
If I use git-bash terminal app (mintty?) directly, I don't see the characters.
➜ echo $PS1
☺☻\n\[\e[38;5;8m\] victor@brix\[\e[38;5;31m\] ~\[\e[39m\] \[\e[38;5;250m\] last: 0m 0s\[\e[38;5;8m\] 18:56:35 \[\e[39m\]\[\e[49m\]\n\[\e[39m\] ➜ \[\e[39m\]\[\e[49m\]
last: 0m 0s 18:56:37
➜ locale
☺☻LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Thought I'd mention. In using Powershell to ssh to Ubuntu host with sbp I see:
When I copy the two characters from the Powershell window and paste them into the Chrome search bar, I clearly see:
On a high-res screen I see that the first character is three letters SOH
and the second character is STX
.
Some googling leads me to identify them as control characters but that is not something I am familiar with at all.
Removing wrapping \[
and \]
from PS0
at sbp.bash#L53 fixes the issue for me.
Some googling lead me to this superuser answer which leads me to believe that \[
and \]
are being interpreted into \001
and \002
respectively which readline sees as the ASCII SOH
and STX
and are being output.
The "fix" does not seem to affect the execution duration calculation when enabling debug mode. Bash isn't my specialty so I defer to others' advice here, I am not sure if there are any side effects to be expected with the workaround.
Looks like this is fix now, please re-open if not.
Upon each command, sbp seems to output two characters
0x01
and0x02
, which my terminal (Windows Terminal app on Win 10) renders as two boxes, no matter which font I'm using. These two "characters" are always between the command and the command output after the line break between them. I haven't modified the default configuration.