Skip to content

eraseLines does not get calculated right, which leads to empty line before bar #172

Description

@BingruLin

Environment

nodejs: 16.20.2
webpack: 5.102.1
webpackbar: 7.0.0

Reproduction

sorry, it's private repo of the company

Describe the bug

As shown in the screenshot below, the weex named progress bar always gets pushed down by an empty line on every update

current_output

I fix the eraseLines function as below and everything works. I wonder whether my fix is correct

diff --git a/node_modules/webpackbar/dist/shared/webpackbar.e03748fc.cjs b/node_modules/webpackbar/dist/shared/webpackbar.e03748fc.cjs
index 4a2a28f..f2422d9 100644
--- a/node_modules/webpackbar/dist/shared/webpackbar.e03748fc.cjs
+++ b/node_modules/webpackbar/dist/shared/webpackbar.e03748fc.cjs
@@ -776,7 +776,7 @@ function ellipsisLeft(str, n) {
 function eraseLines(count) {
   let clear = "";
   for (let i = 0; i < count; i++) {
-    clear += `\x1B[2K` + (i < count - 1 ? `\x1B[1A` : "");
+    clear += `\x1B[2K` + (i < count ? `\x1B[1A` : "");
   }
   if (count)
     clear += `\x1B[G`;
output_after_my_fix

Additional context

No response

Logs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions