Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propmts with newlines work inconsistently #12910

Open
KAAtheWiseGit opened this issue May 20, 2024 · 1 comment
Open

Propmts with newlines work inconsistently #12910

KAAtheWiseGit opened this issue May 20, 2024 · 1 comment
Labels
needs-triage An issue that hasn't had any proper look

Comments

@KAAtheWiseGit
Copy link
Contributor

KAAtheWiseGit commented May 20, 2024

Describe the bug

I tried adding a newline to my prompt indicator, and the rendering seems to be dependents on characters occurring before and after the newline symbol:

# $env.PROMPT_INDICATOR = {|| "> " }
~> ls

# $env.PROMPT_INDICATOR = {|| "\n> " }
~
ls

# $env.PROMPT_INDICATOR = {|| ":\n> " }
~:
> ls

Additionally, while the autocomplete is on, the newline disappears:

~
l <tab>
~| l
ls                   List the filenames, sizes, and modification times of items in a directory.
ld                                                                                                                                                                            
ln                                                                                                                                                                            
let                  Create a variable and give it a value.
loc                  Lines of code counter.
ldd         

Configuration

key value
version 0.92.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-alpine-linux-musl
rust_version rustc 1.77.0 (aedd173a2 2024-03-17) (Alpine Linux 1.77.0-r0)
cargo_version cargo 1.77.0
build_time 2024-04-03 10:33:03 +00:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash, which
installed_plugins
@KAAtheWiseGit KAAtheWiseGit added the needs-triage An issue that hasn't had any proper look label May 20, 2024
@fdncred
Copy link
Collaborator

fdncred commented May 20, 2024

I originally tried to put my newline on my PROMPT_COMMAND but couldn't get it to work, so instead I put it in my PROMPT_INDICATOR. It's the only way I could get it to work. So, I agree, something fishy is going on around this stuff.

This is my prompt.

# prompt
use modules\prompt\oh-my.nu git_prompt
$env.PROMPT_COMMAND = {|| (git_prompt).left_prompt }
$env.PROMPT_COMMAND_RIGHT = {|| (git_prompt).right_prompt }
$env.PROMPT_INDICATOR = {|| if ($env.LAST_EXIT_CODE == 0) {$"(ansi green_bold)\n❯ (ansi reset)"} else {$"(ansi red_bold)\n❯ (ansi reset)"}}
$env.TRANSIENT_PROMPT_COMMAND = ""
$env.TRANSIENT_PROMPT_COMMAND_RIGHT = {|| (git_prompt).right_prompt }
$env.TRANSIENT_PROMPT_INDICATOR = {|| if ($env.LAST_EXIT_CODE == 0) {$"(ansi light_yellow_bold)❯ (ansi reset)"} else {$"(ansi light_red_bold)❯ (ansi reset)"}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage An issue that hasn't had any proper look
Projects
None yet
Development

No branches or pull requests

2 participants