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 prefixing for control character progress bars #102

Merged
merged 2 commits into from
Jul 10, 2020

Conversation

alexcb
Copy link
Collaborator

@alexcb alexcb commented Jul 10, 2020

This fixes the handling of control characters which are used to display
progress bars which use the \r control character.

This fixes the handling of control characters which are used to display
progress bars which use the \r control character.
cl.w.Write(line)
cl.w.Write([]byte("\n"))

output := []byte{}
Copy link
Member

Choose a reason for hiding this comment

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

Should we do something like this here?

Suggested change
output := []byte{}
output := make([]byte, 0, len(data))

... or what would be a better guess of the capacity?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good plan, i'll make that change.

}
}
if len(output) > 0 {
cl.w.Write(output)
output = []byte{}
Copy link
Member

Choose a reason for hiding this comment

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

I think this line makes the inefassign linter complain.

@alexcb alexcb merged commit 6178c52 into master Jul 10, 2020
@alexcb alexcb deleted the issue-96-misaligned-output branch July 10, 2020 21:47
@alexcb alexcb mentioned this pull request Jul 18, 2020
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.

None yet

2 participants