JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.37k stars 2.39k forks source link

Using themes that have text segment on leave 2 letters when using git command history #1172

Closed BaneOfCode closed 2 years ago

BaneOfCode commented 3 years ago

Code of Conduct

What happened?

I am trying to create a custom theme and I noticed that if I hit the up arrow to use my git commands from history it leaves 2 letters in my text segment from the first command in history. I tried other themes with the same result always 2 letters remain in the text segment. I cannot delete those 2 letters and they do not affect commands and I have to Ctrl-c to get them to clear out.

Version

5.18.0

Theme

Blue-owl

What OS are you seeing the problem on?

Windows

Which shell are you using?

bash

Relevant log output

No response

BaneOfCode commented 3 years ago

Also this seems to be happening in Windows Terminal and neovim terminal emulator, but is not happening in a git bash window or VsCode Terminal.

JanDeDobbeleer commented 3 years ago

@Otherone22 do you have a screenshot (I can't reproduce this)?

BaneOfCode commented 3 years ago

image

The re is from reload. I have someone I work with that also has this issue when running bash in windows terminal.

I do know bash has a similar issue on linux if the PS1 statement does not escape characters with 0 length with [ ] around it.

JanDeDobbeleer commented 3 years ago

@Otherone22 we escape everything on bash (using \[ and \], but that's not the issue here). When you say Windows and bash you mean Git BASH right?

BaneOfCode commented 3 years ago

I am using Windows Terminal (From windows store) as my terminal emulator and running a bash profile inside of Windows terminal. If I use the Git Bash console it does not have the issue.

JanDeDobbeleer commented 3 years ago

@Otherone22 I can't reproduce this at all using the theme you mention inside Windows Terminal. Can you make sure that one's up-to-date? Here's a screenshot of my Windows Terminal setup and Git BASH (I pressed up to cycle commands on every line):

image

BaneOfCode commented 3 years ago

I am on the latest version. I will play with some more settings and see if I can figure out what is causing this. I only put an issue here because I also had this issue in neovims terminal emualtor and a coworker also had this issue. I will try to mess around and see if one of my terminal settings is causing this.

ThisWholeDev commented 3 years ago

I am currently getting the same behavior as well. I am using Windows terminal preview version 1.12.2931.0 Oh-my-posh version 5.18.0. I am seeing this in both powershell and bash terminals which both have different themes

image

I can not get it to happen consistently though.

BaneOfCode commented 3 years ago

I have not found anything that cause this behavior to happen but I am seeing it on my home computer as well. It seems to happen when you have longer commands in your history. If you are scrolling through commands and scroll through one that is decently long then the next is short I see the cursor jump to the > symbol on the command line and 2 letters are stuck. I also noticed that pasting long strings like curls don't move to a new line but instead wrap to the front of the terminal.

Here is a docker command that does it with the darkblood.omp.json theme.

image

JanDeDobbeleer commented 3 years ago

OK, let me check if there's an issue with some non-escaped characters.

JanDeDobbeleer commented 2 years ago

@Otherone22 I checked the following:

All tested with Blue-owl. I really can't reproduce this on my end.

JanDeDobbeleer commented 2 years ago

@BaneOfCode same questions here as for others, is your git up to date? We've seen serious issues when using older versions.

BaneOfCode commented 2 years ago

@JanDeDobbeleer Yes I had the latest version but I can update again and try a newer version

Strazdonis commented 2 years ago

Sorry for bringing up this dead issue but did you ever find a solution to this issue? @BaneOfCode Running on newest git, terminal preview and oh-my-posh and I get this problem very frequently.

ehawman-rosenberg commented 2 years ago

@Strazdonis I had something similar to this and the culprit turned out to be the zero-width character \u200b. Did you edit that into your config or are you using stock?

Strazdonis commented 2 years ago

@Strazdonis I had something similar to this and the culprit turned out to be the zero-width character \u200b. Did you edit that into your config or are you using stock?

No, I still get the issue on default config. However I did find the culprit! Seems like there is a bug when rendering emojis in git bash. Adding export LC_ALL=en_US.UTF-8 at the top of my .bashrc solves it and I haven't experienced the bug so far.

JanDeDobbeleer commented 2 years ago

@BaneOfCode can you try @Strazdonis fix and see if that also applies to your issue?

BaneOfCode commented 2 years ago

@JanDeDobbeleer I just added the export statement to my .bashrc and so far I am not seeing it keeping any characters at the start of the lines. I will update this if I find any issues but so far it looks like it worked.

JanDeDobbeleer commented 2 years ago

Closing this on Friday 13 as this seems resolved and I like to gamble with luck.

ehawman-rosenberg commented 2 years ago

@JanDeDobbeleer hopefully we don't get haunted 💀👻

github-actions[bot] commented 9 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.