Closed youk closed 9 months ago
I dug into the documentation and the behavior looks like that of a transient prompt. I checked the init script in use and it unconditionally sets $env.TRANSIENT_PROMPT_COMMAND
(by if "true" == "true"
). From what I am reading in Transient prompt this should be theme-dependent, no?
@youk that's set when there's a transient prompt in the configuration, if I use the theme you use, this is what the script looks like:
$ oh-my-posh init nu --print --config /Users/JDedob/homebrew/opt/oh-my-posh/themes/takuya.omp.json
$env.config = ($env.config | upsert render_right_prompt_on_last_line true)
$env.POWERLINE_COMMAND = 'oh-my-posh'
$env.POSH_THEME = "/Users/JDedob/homebrew/opt/oh-my-posh/themes/takuya.omp.json"
$env.PROMPT_INDICATOR = ""
$env.POSH_PID = (random uuid)
$env.POSH_SHELL_VERSION = (version | get version)
def posh_cmd_duration [] {
# We have to do this because the initial value of `$env.CMD_DURATION_MS` is always `0823`,
# which is an official setting.
# See https://github.com/nushell/nushell/discussions/6402#discussioncomment-3466687.
if $env.CMD_DURATION_MS == "0823" { 0 } else { $env.CMD_DURATION_MS }
}
def posh_width [] {
(term size).columns | into string
}
# PROMPTS
$env.PROMPT_MULTILINE_INDICATOR = (^"/Users/JDedob/homebrew/bin/oh-my-posh" print secondary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.POSH_SHELL_VERSION)")
$env.PROMPT_COMMAND = { ||
# hack to set the cursor line to 1 when the user clears the screen
# this obviously isn't bulletproof, but it's a start
let clear = (history | last 1 | get 0.command) == "clear"
^"/Users/JDedob/homebrew/bin/oh-my-posh" print primary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.POSH_SHELL_VERSION)" $"--execution-time=(posh_cmd_duration)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=(posh_width)" $"--cleared=($clear)"
}
$env.PROMPT_COMMAND_RIGHT = { ||
^"/Users/JDedob/homebrew/bin/oh-my-posh" print right $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.POSH_SHELL_VERSION)" $"--execution-time=(posh_cmd_duration)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=(posh_width)"
}
if "false" == "true" {
$env.TRANSIENT_PROMPT_COMMAND = { ||
^"/Users/JDedob/homebrew/bin/oh-my-posh" print transient $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.POSH_SHELL_VERSION)" $"--execution-time=(posh_cmd_duration)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=(posh_width)"
}
}
if "false" == "true" {
echo ""
}
You can see this isn't activated. The only way it can "stay" activated, is when you initialise with the default config, or one that also has a transient prompt, and then set a configuration without one as those functions are still set. That will also result in the prompt you see, as that's the default transient prompt.
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?
When superseded, two-line prompt loses its styling. For example, this is what happens upon entering
pwd
command:Happens both in Windows Terminal and Windows Console Host.
The same themes work fine with PowerShell:
Theme
Happens with any theme having two-line prompt, e.g.
takuya
.What OS are you seeing the problem on?
Windows
Which shell are you using?
nu
Log output