Skip to content

Commit

Permalink
Fixes the progress bar max width (#5836)
Browse files Browse the repository at this point in the history
**What's the problem this PR addresses?**

I think we added support for the progress bar spinner in 4.0, but forgot
to update the code that prevents the progress bar from being too large
for the terminal.

Fixes #5828

**How did you fix it?**

Updated the code to take the extra two characters into account.

**Checklist**
<!--- Don't worry if you miss something, chores are automatically
tested. -->
<!--- This checklist exists to help you remember doing the chores when
you submit a PR. -->
<!--- Put an `x` in all the boxes that apply. -->
- [x] I have read the [Contributing
Guide](https://yarnpkg.com/advanced/contributing).

<!-- See
https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released
for more details. -->
<!-- Check with `yarn version check` and fix with `yarn version check
-i` -->
- [x] I have set the packages that need to be released for my changes to
be effective.

<!-- The "Testing chores" workflow validates that your PR follows our
guidelines. -->
<!-- If it doesn't pass, click on it to see details as to what your PR
might be missing. -->
- [x] I will check that all automated PR checks pass before the PR gets
reviewed.
  • Loading branch information
arcanis authored Oct 24, 2023
1 parent a1a4e00 commit 577e957
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
34 changes: 34 additions & 0 deletions .yarn/versions/977b46e9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
releases:
"@yarnpkg/cli": patch
"@yarnpkg/core": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-exec"
- "@yarnpkg/plugin-file"
- "@yarnpkg/plugin-git"
- "@yarnpkg/plugin-github"
- "@yarnpkg/plugin-http"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-link"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-pnpm"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/doctor"
- "@yarnpkg/extensions"
- "@yarnpkg/nm"
- "@yarnpkg/pnpify"
- "@yarnpkg/sdks"
5 changes: 2 additions & 3 deletions packages/yarnpkg-core/sources/StreamReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,9 @@ export class StreamReport extends Report {
}

getRecommendedLength() {
const PREFIX_SIZE = `➤ YN0000: `.length;
const PREFIX_SIZE = `➤ YN0000: `.length;

// The -1 is to account for terminals that would wrap after
// the last column rather before the first overwrite
// The `- 1` is to account for terminals that would wrap after the last column rather before the first overwrite
const recommendedLength = this.progressStyle !== null
? (this.stdout as WriteStream).columns - 1
: super.getRecommendedLength();
Expand Down

0 comments on commit 577e957

Please sign in to comment.