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
fix(_lp_fill): avoid costly strip_escape on filling sequence #803
Conversation
The previous behavior was to allow escaped sequences in the *fillchars* argument of _lp_fill. This could lead to a very slow call to __lp_strip_escapes if the gap was large. The new behavior is to remove escaped sequences from fillchars, but allow them in the new arguments *fillprefix* and *fillsuffix*. This actually simplifies the _lp_fill function a bit. This patch also removes fixed COLUMNS in theme-preview.sh and fix a spacing problem in the unfold theme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does seem like an improvement. But I don't see the point of fillprefix
and fillsufix
. Every time you use them, you concat them together with left
and right
respectively. Why not leave off these new params, and simply document that fillstring
will have any formatting removed, so if you want to format it, add that formatting at the end of left
(and to reset formatting at the beginning of right
if that is what you want).
That's definitely right, it seems obvious in retrospect. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look good. Only a few comment issues.
Edit: and the tests are failing.
Yes, I got interrupted while working on it (on a separate commit). Hence why I did not re-request a new review right away :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
The previous behavior was to allow escaped sequences in the fillchars argument of _lp_fill. This could lead to a very slow call to __lp_strip_escapes if the gap was large.
The new behavior is to remove escaped sequences from fillchars, but allow them in the new arguments fillprefix and fillsuffix.
This actually simplifies the _lp_fill function a bit.
This patch also removes fixed COLUMNS in theme-preview.sh and fix a spacing problem in the unfold theme.
Ref: this thread on liquidprompt-powerline