Closed magma-chili closed 1 year ago
@magma-chili I'll have a look at why we're (seemingly) counting the length incorrectly. Because that's what we do, and then fill remaining space with spaces since that version.
@magma-chili so, you can't use raw hyperlink ANSI in a template as we can't count the prompt length correctly in that case. You can however make use of our built-in function to create such links using {{ path .Text .Location }}
so we can correctly count the actual characters. Stripping ANSI is almost impossible without writing an interpreter for the sake of counting strings so you can't add that from a segment's template. Please rewrite the template function so it uses our link builder and you'll be fine.
@magma-chili so, you can't use raw hyperlink ANSI in a template as we can't count the prompt length correctly in that case. You can however make use of our built-in function to create such links using
{{ path .Text .Location }}
so we can correctly count the actual characters. Stripping ANSI is almost impossible without writing an interpreter for the sake of counting strings so you can't add that from a segment's template. Please rewrite the template function so it uses our link builder and you'll be fine.
Thanks that built-in function works nicely.
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.
Code of Conduct
What happened?
Hi,
Overview
This happens using powershell and pwsh in Windows Terminal version 1.17.114610.
Since version 18.2.3, my customized prompt has had a spacing issue between a customized
text
(path)segment
which renders each folder as a clickable hyperlink to open said folder and aprompt
that normally is aligned to the right. I was really happy with the way it worked until this issue started, and I don't know if what I'm seeing is a bug or if I've been abusing a bug as a feature, but I'm guessing my issue came from fix(rprompt): position using spaces instead of ANSI · JanDeDobbeleer/oh-my-posh@181b789 (github.com) or fix(prompt): print right block using spaces · JanDeDobbeleer/oh-my-posh@c23069b (github.com) in version 18.2.3Example screenshots
oh-my-posh version with issue: 18.2.3+
oh-my-posh version without issue: 18.2.2
Explanation
My powershell profile sets
$env:Posh_CWD
to the current working directory path string.The go template code is ugly to my eyes in JSON format, but the
text
template
operating on.Env.Posh_CWD
in the codeblock below splits the path and loops through each segment, creating links in between custom separators.Bug or misconfiguration?
Is there something wrong with the way I am doing this or is this a bug?
Theme
A custom config I designed called
blades.omp.json
which requires a lot of extra powershell code in the powershell profile file to work.What OS are you seeing the problem on?
Windows
Which shell are you using?
powershell
Log output