Skip to content

Conversation

mogzol
Copy link

@mogzol mogzol commented Apr 3, 2025

Fixes #164

Previously, extra lines were counted only by the number of line breaks in them, so the number of lines cleared would be incorrect if any lines wrapped. Additionally, prevLineCount could be wrong if the size of the terminal changes between renders.

To fix this, the number of lines to clear is calculated immediately before clearing them, and the 'string-width' library is used to determine accurate widths and line counts. This is the same library used by 'wrap-ansi', so it should be reliable, and it is not actually a new dependency.

Previously, extra lines were counted only by the number of line breaks
in them, so the number of lines cleared would be incorrect if any lines
wrapped. Additionally, prevLineCount could be wrong if the size of the
terminal changes between renders.

To fix this, the number of lines to clear is calculated immediately
before clearing them, and the 'string-width' library is used to
determine accurate widths. This is the same library used by 'wrap-ansi',
so it should be reliable, and it is not actually a new dependency.
@mogzol
Copy link
Author

mogzol commented Apr 7, 2025

I also have some changes to add an option to fix #97: mogzol@cdd5547

But since they depend on these changes, I'll open another PR if/when this one gets merged

@mogzol
Copy link
Author

mogzol commented Apr 22, 2025

I made a tag in my forked repo with both this fix and the new keepOnBottom option I added so that I could use it while waiting for this PR to be reviewed. If anyone wants to try it you can install it with:

npm install --save-dev https://github.com/mogzol/webpackbar.git#7.0.0-mod

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

Successfully merging this pull request may close these issues.

Bar gets duplicated if a long line is printed during build
1 participant