Skip to content

Fix attempt to subtract with overflow (#582)#586

Merged
chris-laplante merged 5 commits intoconsole-rs:mainfrom
smoelius:orphan-lines
Sep 20, 2023
Merged

Fix attempt to subtract with overflow (#582)#586
chris-laplante merged 5 commits intoconsole-rs:mainfrom
smoelius:orphan-lines

Conversation

@smoelius
Copy link
Copy Markdown
Contributor

@smoelius smoelius commented Sep 8, 2023

Fixes #582

The test orphan_lines reproduces the panic. The test orphan_lines_message_above_progress_bar tries to ensure that messages are still printed correctly following the fix.

The proposed fix is to effectively ignore self.orphan_lines_count many lines from real_len when comparing real_len to the terminal height.

@oli-obk Would you be able to glance at this? 🙏

Copy link
Copy Markdown
Member

@djc djc left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for digging into this! Will leave this open for other reviews, feel free to ping me in a week or so.

@smoelius
Copy link
Copy Markdown
Contributor Author

Sorry, I failed to fix a comment.

To whomever keeps approving the workflows: thank you. 🙏

@chris-laplante
Copy link
Copy Markdown
Collaborator

To whomever keeps approving the workflows: thank you. 🙏

We gotchu :)

@djc
Copy link
Copy Markdown
Member

djc commented Sep 19, 2023

@chris-laplante do you want to do a final review before (squash and) merge?

@smoelius thanks for your work in getting this right, and @oli-obk thanks for the reviews!

Copy link
Copy Markdown
Collaborator

@chris-laplante chris-laplante left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks for the new tests too :)

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.

Attempt to subtract with overflow when output exceeds terminal height

4 participants