-
Notifications
You must be signed in to change notification settings - Fork 422
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
lp fill
incompatible with _lp_analog_time
#814
Comments
Yeah, this is a tricky one. My dream is to have a function that will take a string and return its printable width. I did some research in the past on this, and it is pretty impossible to do in Shell. The best idea I had was to print the string, and ask the terminal where the cursor ended up. That is guaranteed to be the correct answer, but it means more terminal emulator hacking, and if the terminal emulator is not fast, the user might see a flicker of the string before it gets overwritten. But if we can't get a perfect solution, I guess your hack could work. It sounds super hacky though, and not likely to be easy for themes to do correctly. |
Another option would be to add a space after all the clock characters, right at declaration. That way, the width will actually be explicitly two characters wide, which will allow |
Wait, does that work? Terminal emulators won't render that as 3 width wide? |
I thought I had tried that before and it was working (maybe for some characters, depending on metadata?), but at least here, with the clock characters, it does not. |
When using LP_TIME_ANALOG, the clock character is two-characters wide in a terminal with fixed-size font, hence making computation of the width by
lp_fill
wrong by one character, making the end of line overshooting.Liquid Prompt version: v2.2.0.rc-2
Steps to Reproduce
Expected Behavior
Line width should not overshoot.
Possible Solution
Add an option in
lp_fill
to force aiming at width minus n characters, so that themes using it can fix width computation whenever some option (here, at leastLP_TIME_ANALOG
) is active or not.The text was updated successfully, but these errors were encountered: