Skip to content

Fix measuring terminal width for output - #1635

Merged
mislav merged 1 commit into
trunkfrom
table-width-fix
Sep 8, 2020
Merged

Fix measuring terminal width for output#1635
mislav merged 1 commit into
trunkfrom
table-width-fix

Conversation

@mislav

@mislav mislav commented Sep 7, 2020

Copy link
Copy Markdown
Contributor

Preserve a reference to original os.Stdout (pre-colorable) so we can use it to measure terminal width.

Fixes #1618
Followup to #1607

@samcoe samcoe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The code looks good to me. My only question is why does colorable change the terminal width?

@mislav
mislav merged commit d13e6b3 into trunk Sep 8, 2020
@mislav
mislav deleted the table-width-fix branch September 8, 2020 08:01
@mislav

mislav commented Sep 8, 2020

Copy link
Copy Markdown
Contributor Author

My only question is why does colorable change the terminal width?

On Windows, NewColorable returns a different Writer stream that was passed in, and that one is not suitable for determining terminal features such as size. Therefore, we have to keep a reference to the original stdout stream somehow.

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.

issue list command output has gotten narrow!

2 participants