warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
21.4k stars 375 forks source link

Starship arrow (character) in prompt block (ZSH) #3262

Closed dylandifilippo closed 1 year ago

dylandifilippo commented 1 year ago

Discord username (optional)

No response

Describe the bug

I discovered today that the arrow of the Starship prompt is within the block and not behaving as it should. I also looked into a previous issue but it didn't solve my bug: https://github.com/warpdotdev/Warp/issues/3066

To reproduce

I'm on MacOS with starship and the nerd font style preset: https://starship.rs/presets/nerd-font.html

Expected behavior

The arrow shouldn't be at this position, either at the end of the line of my repo (+ branch + programming language).

CleanShot 2023-06-27 at 09 37 10@2x

Screenshots

CleanShot 2023-06-26 at 15 22 37@2x

Operating system

MacOS

Operating system and version

13.4.1 (22F82)

Shell Version

zsh 5.9 (x86_64-apple-darwin22.0)

Current Warp version

v0.2023.06.20.08.04.stable_03

Regression

No, this bug or issue has existed throughout my experience using Warp

Recent working Warp date

No response

Additional context

No response

Does this block you from using Warp daily?

No

Is this a Warp specific issue? (i.e. does it happen in Terminal, iTerm, Kitty, etc.)

Yes, this I confirmed this only happens in Warp, not other terminals.

Warp Internal (ignore): linear-label:b8107fdf-ba31-488d-b103-d271c89cac3e

None

dannyneira commented 1 year ago

Hey @dylandifilippo thanks for submitting. So given how the input editor works like an IDE and is separate from the prompt in Warp, I'm not how much refactoring will be needed to make them both in one line as you expect in other terminals. So I just want to set the expectation that it may be a while before this is implemented.

That being said, there is a related request for prompt + input in one line you can track here: https://github.com/warpdotdev/Warp/issues/2304

CaptainVincent commented 1 year ago
~
βœ“
echo 123
123

I also noticed this issue. I think he means there is an extra line break in Warp. If your run inside tmux. You could get below

~
βœ“ echo 123
123

This is my config

format = """
$username\
$hostname\
$directory\
$git_branch\
$git_state\
$git_status\
$git_metrics\
$line_break\
$character"""
dylandifilippo commented 1 year ago

Hey @dannyneira, I didn't formulate my expected behaviour correctly. I just want it to behave as it is displayed on the homepage of this repository.

warp-starship
dylandifilippo commented 1 year ago

I found out what might've caused this.

So I see that you don't support this: https://docs.warp.dev/features/prompt#multi-line-and-right-sided-prompts

Then I added this line of code in the starship.toml config file:

[line_break]
disabled = true

It solved what I wanted in Warp:

CleanShot 2023-06-27 at 16 13 09@2x

Well, now it is not what I want in VsCode's terminal, but we can't have everything πŸ€ͺ

CleanShot 2023-06-27 at 16 13 37@2x
CaptainVincent commented 1 year ago

Just as I said? I think there is an issue with an extra line break when handling prompts in warp. The behavior in VS Code is consistent with tmux and other terminals, I believe. πŸ€”

dannyneira commented 1 year ago

Hey Folks, Warp should now support multi-line and right-sided prompts in zsh and fish shells. Please let us know if that isn't the case for you. (prompt and input will still remain separate, due to the way Warp's input editor works like an IDE)

CleanShot 2023-06-27 at 11 38 43

dylandifilippo commented 1 year ago

Hey @dannyneira, I don't understand. Should I do something specific ?

dannyneira commented 1 year ago

Hey @dannyneira, should I do something specific, I don't understand.

Try setting line break disabled to false or comment it out Also make sure your on the latest versions of Warp, zsh, starship.

dylandifilippo commented 1 year ago

I just did all this and it doesn't solve the problem.

dannyneira commented 1 year ago

If you don't mind sharing your starship. toml I can take a look and try to reproduce the issue.

dylandifilippo commented 1 year ago
[bun]
format = "via [$symbol]($style)"

[buf]
format = "via [$symbol]($style)"

[cmake]
format = "via [$symbol]($style)"

[cobol]
format = "via [$symbol]($style)"

[crystal]
format = "via [$symbol]($style)"

[daml]
format = "via [$symbol]($style)"

[dart]
format = "via [$symbol]($style)"

[deno]
format = "via [$symbol]($style)"

[dotnet]
format = "[$symbol(🎯 $tfm )]($style)"

[elixir]
format = 'via [$symbol]($style)'

[elm]
format = 'via [$symbol]($style)'

[erlang]
format = 'via [$symbol]($style)'

[golang]
format = 'via [$symbol]($style)'

[haxe]
format = 'via [$symbol]($style)'

[helm]
format = 'via [$symbol]($style)'

[julia]
format = 'via [$symbol]($style)'

[kotlin]
format = 'via [$symbol]($style)'

[lua]
format = 'via [$symbol]($style)'

[meson]
format = 'via [$symbol]($style)'

[nim]
format = 'via [$symbol]($style)'

[nodejs]
format = 'via [$symbol]($style)'

[ocaml]
format = 'via [$symbol(\($switch_indicator$switch_name\) )]($style)'

[opa]
format = 'via [$symbol]($style)'

[perl]
format = 'via [$symbol]($style)'

[php]
format = 'via [$symbol]($style)'

[pulumi]
format = 'via [$symbol$stack]($style)'

[purescript]
format = 'via [$symbol]($style)'

[python]
format = 'via [$symbol]($style)'

[raku]
format = 'via [$symbol]($style)'

[red]
format = 'via [$symbol]($style)'

[rlang]
format = 'via [$symbol]($style)'

[ruby]
format = 'via [$symbol]($style)'

[rust]
format = 'via [$symbol]($style)'

[swift]
format = 'via [$symbol]($style)'

[vagrant]
format = 'via [$symbol]($style)'

[vlang]
format = 'via [$symbol]($style)'

[zig]
format = 'via [$symbol]($style)'

[line_break]
disabled = false

[git_metrics]
disabled = false

[git_status]
conflicted = '🏳'
ahead = 'πŸŽπŸ’¨${count}'
behind = '😰${count}'
diverged = 'πŸ˜΅β‡•β‡‘${ahead_count}⇣${behind_count}'
# up_to_date = 'πŸ‘'
untracked = '🀷'
stashed = 'πŸ“¦'
modified = 'πŸ“'
staged = '[++\($count\)](green)'
renamed = 'πŸ‘…'
deleted = 'πŸ—‘'
dannyneira commented 1 year ago

So I tried with your starship.toml file and it all was rendering properly.

CleanShot 2023-06-27 at 12 47 02

My guess is that you normally have a zsh plugin or tool and Warp is unable to parse it.

You can check whether it’s something in your dotfiles by setting up clean configs: Run echo 'ZDOTDIR=/' > ~/.zshenv

This forces Zsh to run with zero configs, and if that works then it's certainly something in your rc files causing the issue, and I recommend you disable the unsupported/breaking parts of your dotfiles just for Warp by using this conditional statement:

# Bash and Zsh
if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then
# > What you want to disable here <
fi

We have a list of incompatible tools here: https://docs.warp.dev/help/known-issues#list-of-incompatible-tools

If you care to share a redacted version of your rc file i can also try it as well and see what the issue may be.

CaptainVincent commented 1 year ago

Hi ~ @dannyneira Could you explain why the commands(the position where input is displayed when typed) in warp are not appearing after ">"? This behavior seems inconsistent with other terminals. right?

dannyneira commented 1 year ago

@CaptainVincent This has to do with the fact that the input editor and the prompt are separated in Warp. This enables the IDE-like input editing and completions in Warp so it's unlikely to change in the future.

CaptainVincent commented 1 year ago

Understood.

declanchiu commented 1 year ago

image

I also encountered this problem, so from Dannyeira's reply, it shouldn't be easy to fix this problem with wrap later, so I can only modify the configuration by myself to solve it.

Advait-M commented 1 year ago

Hey folks @CaptainVincent @dylandifilippo @declanchiu ! Just a note - we're actively working on supporting the ability to have the command appear on the same line as the prompt πŸ˜„ . I'm tracking updates on this in #2304.

Gonna close this out - please head over there for keeping track of progress!

obsidian33 commented 4 months ago

Now with Warp v0.2024.07.09.08.01.stable_00 you can now choose whether you'd like your prompt on a new line (Warp's default) or on the same line with commands, like a classic terminal.

When using Starship we're using a custom PS1, and Warp will use the same line prompt setting to respect theme configurations. So it will behave like any other terminal for the most part.

But unfortunately Starhip seems to be adding an "indent" to the prompt if I have:

[character]
success_symbol = ''
error_symbol = ''

image

If I don't use the empty string for the character module, it then appears to line up correctly: image

Let me know if I should open up another issue for this. The context here did seem somewhat relevant.

dylandifilippo commented 4 months ago

Hello @obsidian33, I'm not using Starship anymore, I'm using ohmyposh but it the same principle than Starship. I can attest that the problem is solved, thanks a lot!