Oh-my-posh3: Theme not working correctly after installing v3.23

Created on 27 Oct 2020  路  4Comments  路  Source: JanDeDobbeleer/oh-my-posh3

Prerequisites

  • [x] I have read and understand the CONTRIBUTING guide
  • [x] I looked for duplicate issues before submitting this one

Description

After installing v.3.23, the custom theme that I created that uses an envvar segment for the prompt does not display correctly after the module is imported. Subsequently, the prompt is written correctly.

I am guessing this is because the prompt is written before the initial call to Set-PoshContext now?

See screenshot below:

Screenshot 2020-10-26 200625

Environment

  • Oh my Posh version: 3.23.1
  • Theme: Custom (https://gist.github.com/AjayKMehta/1b5324a485a9db6e7d326276ab5786cf)
  • Operating System: Windows 10
  • Shell: PowerShell 7.0.3
  • Terminal: pwsh

Steps to Reproduce

Set-PSReadLineOption -HistorySaveStyle SaveIncrementally

Import-Module 'posh-git', 'oh-my-posh' -Force

function Set-EnvVar {
    $env:POSH=$(if ((Get-PSReadLineOption).HistorySaveStyle -ne 'SaveNothing'){[char]::ConvertFromUtf32(0x1f4be)} else {''})
}

if (Get-Alias 'Set-PoshContext' -ErrorAction Ignore) {
    Remove-Alias 'Set-PoshContext'
}

New-Alias -Name 'Set-PoshContext' -Value 'Set-EnvVar' -Scope Global

Set-PoshPrompt -Theme "$PSScriptRoot\Themes\cool.json"

Expected behavior:

I expected to see a segment at the end with 馃捑 in the prompt after running the code (copied from my profile.ps1).

Actual behavior:
There is no segment at the end with 馃捑 in it. Subsequently, the prompt is written correctly, i.e. a segment at the end with 馃捑 .

All 4 comments

Works great now. Thanks, @JanDeDobbeleer ! This version is even more awesome than the original version 馃憤

You have no idea how much I appreciate feedback like that. I spent countless hours with that goal in mind, so to hear that from someone else than myself is amazing 馃檹馃徎

I realize from personal experience, how difficult it is to find time to work on OSS projects and to stay motivated when there are 10 million other things competing for your attention. I would love to contribute to this project but I don't know Go. I was thinking of adding a page to docs listing compatible fonts for builtin themes and and updating README.md to reflect this.

Also, do you think it would be worthwhile to create a separate repo for themes and allow people to contribute their themes there via PRs? This way the engine or PS module doesn't need to be released if there is a change to theme(s).

That could work, however, in all honesty, given that everything is automated, adding themes and creating a release is perfectly possible. Doesn't hurt 馃檪

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Cruik picture Cruik  路  9Comments

firlus picture firlus  路  10Comments

ozerty picture ozerty  路  7Comments

MJECloud picture MJECloud  路  3Comments

cdhunt picture cdhunt  路  3Comments