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

Cursor position incorrect when using Laravel 10 with prompt element #2534

Closed
jamesdeacon opened this issue Jan 15, 2024 · 13 comments
Closed

Comments

@jamesdeacon
Copy link

When the Laravel prompt element is turned on and Laravel 10 is installed, the cursor shows up in the incorrect position, see screenshot for more detail. On top of this the Laravel version number is also showing in the incorrect color, it should be showing in red as it does for all other Laravel versions.

image
@romkatv
Copy link
Owner

romkatv commented Jan 15, 2024

What terminal is this and what is the output of locale?

@jamesdeacon
Copy link
Author

Screenshot is from iTerm but I see the same behaviour on MacOS Terminal.

Output of locale is:

LANG="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_CTYPE="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_ALL=

@romkatv
Copy link
Owner

romkatv commented Jan 15, 2024

Does the output of the following command contain colored bits? Could you post a screenshot?

php artisan --version

This needs to be run in the project directory.

@jamesdeacon
Copy link
Author

Yes it does, and it matches the color used in the prompt element.

image

@romkatv
Copy link
Owner

romkatv commented Jan 15, 2024

Wow. They'll probably fix this so that colors aren't written when stdout is not a TTY, but in the meantime I can add a workaround.

Please send me the output of the following command. Hopefully it'll be the last one I'll ask you to run.

printf '%q\n' "$(php artisan --version)"

@jamesdeacon
Copy link
Author

Sure thing, here's that output:

image

Just for reference, php artisan --version outputs the color on projects that are on Laravel 9 too but the cursor is in the correct position and the color on the prompt element is correct too

image

@romkatv
Copy link
Owner

romkatv commented Jan 15, 2024

Fixed. Please update powerlevel10k and verify whether it now works correctly for you.

Just for reference, php artisan --version outputs the color on projects that are on Laravel 9 too but the cursor is in the correct position and the color on the prompt element is correct too

Apparently, versions prior to 10 don't have this bug: they output colors only when the stdout is a TTY. You can verify this with php artisan --version | cat. The output should not have colors but with 10.40.0 it does.

@jamesdeacon
Copy link
Author

I've installed powerlevel10k using brew. What's the best way for me to update seeing as brew is showing as up-to-date

@romkatv
Copy link
Owner

romkatv commented Jan 15, 2024

You could ditch brew for now and use the manual installation option, at least until I cut a new release.

  1. Comment out this line in ~/.zshrc:
    source $(brew --prefix)/share/powerlevel10k/powerlevel10k.zsh-theme
  2. Run this:
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
    echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
  3. Restart zsh with exec zsh.

@jamesdeacon
Copy link
Author

I've done that and it's not showing a Laravel version at all anymore:

image

This is also the case on any Laravel projects, not just Laravel 10.

I still have the laravel_version set in my POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS

image

@romkatv
Copy link
Owner

romkatv commented Jan 15, 2024

🤦‍♂️ f5d5abf

Please try again.

@jamesdeacon
Copy link
Author

Hooray! All working

image

Thanks so much

@romkatv
Copy link
Owner

romkatv commented Jan 15, 2024

Thanks a ton for you help on this issue: from reporting and remote debugging to verifying and even catching the silly bug I pushed! <3

@romkatv romkatv closed this as completed Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants