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

fix(_lp_fill): avoid costly strip_escape on filling sequence #803

Merged
merged 3 commits into from Nov 12, 2023

Conversation

nojhan
Copy link
Collaborator

@nojhan nojhan commented Nov 5, 2023

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

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.
@nojhan nojhan requested a review from Rycieos November 5, 2023 17:15
@nojhan nojhan self-assigned this Nov 5, 2023
@nojhan nojhan added the bug label Nov 5, 2023
@nojhan nojhan added this to the v2.2 milestone Nov 5, 2023
Copy link
Collaborator

@Rycieos Rycieos left a 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).

tools/theme-preview.sh Show resolved Hide resolved
docs/functions/util.rst Outdated Show resolved Hide resolved
@nojhan
Copy link
Collaborator Author

nojhan commented Nov 12, 2023

This does seem like an improvement. But I don't see the point of fillprefix and fillsufix.

That's definitely right, it seems obvious in retrospect.

Copy link
Collaborator

@Rycieos Rycieos left a 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.

liquidprompt Outdated Show resolved Hide resolved
liquidprompt Outdated Show resolved Hide resolved
@nojhan
Copy link
Collaborator Author

nojhan commented Nov 12, 2023

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 :-)

@nojhan nojhan requested a review from Rycieos November 12, 2023 16:48
Copy link
Collaborator

@Rycieos Rycieos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@Rycieos Rycieos merged commit b1ea560 into master Nov 12, 2023
9 checks passed
@Rycieos Rycieos deleted the fix/lp_fill branch November 12, 2023 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants