Comments (25)
@Bilge weird this has never been reported before. I can try to have a look.
from oh-my-posh.
Due to git bash' broken nature it can't interact nicely with the native Windows API and thus reported the incorrect terminal width. Fix incoming.
from oh-my-posh.
@Bilge after a good night's rest, I found the issue and oh-my-posh is responsible. We escape \
as it's used inside PS1 to control escape sequences and substitution, but it resulted in having the incorrect prompt length count. I have a draft ready that needs one more addition before being able to merge, but can confirm this is cleaner and solves the issue entirely.
from oh-my-posh.
@hungnguyen1503 set COLUMNS=0
just before the oh-my-posh init line. I'll fix it ASAP. Wasn't aware there were bash versions that do not set that variable.
from oh-my-posh.
Thanks for the fast fix 🙂 👍🏻
The default theme is right-aligned; my (slightly modified) version of P10K is not quite aligned to the right-hand edge but that probably just requires some tweaking.
from oh-my-posh.
Actually, it's still doing the weird thing where descending into directories is pulling further and further away from the right-hand edge. Only in the home directory is it flush against the right-hand side.
from oh-my-posh.
I'll have a look, this shouldn't happen although it can be another git bash bug. Does the same happen inside Windows Terminal?
from oh-my-posh.
It does not happen in PowerShell in Windows Terminal... although it's not really a fair test since I'm not using the Nerd font in Windows Terminal (nor am I using Bash). I tried to get it to run in WSL 1, but it doesn't work because the init script spits out the host path instead of the mounted path in WSL.
from oh-my-posh.
@Bilge you can run bash also in Windows Terminal, doesn't need to be PWSH.
from oh-my-posh.
Sure, but it keeps messing up the path. Whether under WSL 1 or just cmd.exe
, for some reason the path to oh-my-posh.exe is /mnt/c/Program Files (x86)/oh-my-posh/bin/oh-my-posh.exe
, but the init
script keeps spitting out, C:/Program Files (x86)/oh-my-posh/bin/oh-my-posh.exe
, which it cannot find (another bug?).
To be clear, the init script is the same under git Bash, but git Bash is clever in that it automatically remaps references to C:/
; other environments cannot do that.
from oh-my-posh.
@Bilge not a bug. When using WSL, you need to use the linux executable. I meant you can run git bash, which is a Windows runtime faking linux tooling, inside Terminal. WSL is a linux runtime, so it needs to Linux oh-my-posh to work.
from oh-my-posh.
So you claim, and yet WSL 1 can run Windows native binaries, including oh-my-posh just fine. After all, it spits out the init script, it's only the paths that are incorrect. Case in point, oh-my-posh.exe print primary
also works in WSL 1. I could probably search/replace the path references and it would work as expected.
Of course, what you are suggesting isn't wrong; I could install it twice, using the native runtime, it's just that I don't want to install it twice 🙂
from oh-my-posh.
@Bilge I know it can, and on WSL1 it will be "fast", on 2 slow and it's going to interact with Windows API's whereas the context is actually a linux runtime. It can be solved, but I purposefully don't do that. It's not a good idea.
from oh-my-posh.
Anyway, using the print primary
command, I can see that there is no such issue under Windows Terminal (with its default font), so it's either a font issue or a git Bash issue.
from oh-my-posh.
@Bilge I'm going to have a look, always interesting.
from oh-my-posh.
Having installed the LiterationMono Nerd Font in Windows Terminal, it still seems to be printing consistent widths (with consistent right-alignment), so the alignment issue seems to be purely isolated to git Bash. Probably I am the only one trying to use OMP in the git Bash environment, which is why none of these issues have been discovered before 😆
from oh-my-posh.
@Bilge trust me, there are plenty 😁 But, people do tend to use Windows Terminal with git bash rather than mintty.
from oh-my-posh.
Uh... git Bash uses mintty. They are, effectively, one and the same.
from oh-my-posh.
@Bilge mintty is the terminal emulator, not the shell. You can run git bash as is inside Windows Terminal.
from oh-my-posh.
Oh, heh. Well I ran the git Bash specific flavour of Bash inside WSL 1 and it actually exhibits the same behaviour. So it is a git Bash issue (probably not a mintty issue).
from oh-my-posh.
@Bilge you can use this configuration to see what bash behaves like in Windows Terminal:
{
"commandline": "%PROGRAMFILES%/Git/usr/bin/bash.exe -i -l",
"guid": "{00000000-0000-0000-ba54-000000000002}",
"icon": "%PROGRAMFILES%/Git/mingw64/share/git/git-for-windows.ico",
"name": "Bash",
"startingDirectory": "%USERPROFILE%"
}
Git Bash is actually mintty that runs this bash version inside as a packaged entity.
That said, I don't have the above issue with my theme.
![image](https://private-user-images.githubusercontent.com/2492783/340031925-095c314b-b8d1-43d3-8ef3-fe2577d0c792.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkyODU2NDksIm5iZiI6MTcxOTI4NTM0OSwicGF0aCI6Ii8yNDkyNzgzLzM0MDAzMTkyNS0wOTVjMzE0Yi1iOGQxLTQzZDMtOGVmMy1mZTI1NzdkMGM3OTIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjVUMDMxNTQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9M2YxMGFkODE0ZTBlZDA2NTZjODBmNGIwYjc5YjY2ZDAxZGU0ZWU3Y2RmMzlmNTIxZTFkNDg0YTQ1NGMyMzc1NCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.ZK9I1fCDcrcOpKkwXG7JpHgyRdX8Ny57b0hKdGSEWy8)
I can reproduce this using Git's Bash with powerlevel10k_rainbow.omp.json
, but not on native bash. The \
character in the path is what's causing it, but that's escaped. So this is a bug in Git Bash apparently.
![image](https://private-user-images.githubusercontent.com/2492783/340033852-236722da-f7db-4646-8950-1c218ce9558e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkyODU2NDksIm5iZiI6MTcxOTI4NTM0OSwicGF0aCI6Ii8yNDkyNzgzLzM0MDAzMzg1Mi0yMzY3MjJkYS1mN2RiLTQ2NDYtODk1MC0xYzIxOGNlOTU1OGUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjVUMDMxNTQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NzA1NjliNGNkMmU1Y2RhYzMzMmUyYTAzY2M2MmFhYmM1MWZhNTJhMGVkNDIzYjQ3YzI1OGViNjQzOTVjNDFiOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.WVaAGiOWy04WJors02_xhXGa2GHq7nb6z61S-3ZEsII)
You can fix it by adjusting the configuration for the path
segment to use a forward slash as path separator "folder_separator_icon": "/"
.
![image](https://private-user-images.githubusercontent.com/2492783/340033999-26a37ae3-cd4d-4660-be8d-1cedac255adb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkyODU2NDksIm5iZiI6MTcxOTI4NTM0OSwicGF0aCI6Ii8yNDkyNzgzLzM0MDAzMzk5OS0yNmEzN2FlMy1jZDRkLTQ2NjAtYmU4ZC0xY2VkYWMyNTVhZGIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjVUMDMxNTQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NWI4MjVlYTI4NTg1ODEwNTVhZWU1YjcxYzBiZmIzNjhiY2I5NDA3NDcyZTBhYmY2ZTc2OGIxYTJiNjBjYmY4MCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ._g0GDtyG7T2XUSYA3Ea_2UkVbZFwZ4godMrGms3eN90)
I'll see if I can add that as the native behaviour and hopefully that's the last of Git Bash' shenanigans. I do promote the use of nushell when you dislike PowerShell on Windows, that's a really, really good shell that integrates natively with Windows unlike Git Bash.
from oh-my-posh.
I guess changing folder_separator_icon
is an OK workaround, but perhaps a bug should be filed with git-for-windows/git?
from oh-my-posh.
@Bilge I can reproduce the issue on bash anywhere using "folder_separator_icon": "\\"
so it's some sort of magical bash issue. The \
character is escaped, yet it has this strange side effect. I can definitely make sure this will always fallback to /
on bash, but weird nonetheless.
from oh-my-posh.
Hi @JanDeDobbeleer,
I have a problem after using the latest version. Could you please support me to fix it?
from oh-my-posh.
Hi @JanDeDobbeleer,
It was fixed, thank you so much.
from oh-my-posh.
Related Issues (20)
- VS Code shows raw ANSI sequences with Powershell HOT 1
- Weird text showing with integrated vscode terminal HOT 1
- Include running command in console title template HOT 4
- Extra paddings when running in Docker
- Detect first/last prompt segment HOT 10
- "disable_notice": true is not working as expected HOT 3
- Path location hyperlinks broken in Bash on Windows HOT 1
- Prompt stuck when `cd` -ing into a large git repository HOT 1
- feat(pwd): add support for OSC8 HOT 4
- Typing multiple commands before the first one finishes HOT 4
- Winget not updated from the Microsoft Store HOT 1
- Incorrect Powerline symbols rendered in JetBrains terminals HOT 1
- Pass terminal width to command segment HOT 6
- Nightscout Segment not working due to API changes HOT 3
- Remove Deprecated Homebrew Tap for Nerd Fonts Installation
- Debug Prompt Logic Change With `$Host`
- Refresh interval HOT 1
- Git remote information (Remote URL, ahead, behind) populate incorrectly
- Shell not displaying Python segment via Pyenv bash
- Settings are gone after closing the terminal HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oh-my-posh.