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

Buffer Restore: Fix serializing >32KiB #17022

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Apr 5, 2024

I forgot to buffer.clear() after a write. Whoops.

This includes 2 additional, smaller improvements that I just happened
to notice: The GenRTF code calls to_string despite using fmt.

@lhecker lhecker added Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. Priority-1 A description (P1) labels Apr 5, 2024
@@ -2375,7 +2375,7 @@ std::string TextBuffer::GenRTF(const CopyRequest& req,

// \fsN: specifies font size in half-points. E.g. \fs20 results in a font
// size of 10 pts. That's why, font size is multiplied by 2 here.
fmt::format_to(std::back_inserter(contentBuilder), FMT_COMPILE("\\fs{}"), std::to_string(2 * fontHeightPoints));
fmt::format_to(std::back_inserter(contentBuilder), FMT_COMPILE("\\fs{}"), 2 * fontHeightPoints);
Copy link
Member Author

Choose a reason for hiding this comment

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

FYI the type of fontHeightPoints is int, so there should be no difference in behavior here.

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

ah, does this result in buffer growing infinitely if there's more than 32kb to write?

@lhecker
Copy link
Member Author

lhecker commented Apr 5, 2024

Yup exactly. That's how you end up with a 62GB buffer.txt. 😄

@lhecker lhecker added this pull request to the merge queue Apr 5, 2024
Merged via the queue into main with commit 8d6e7a8 Apr 5, 2024
20 checks passed
@lhecker lhecker deleted the dev/lhecker/961-buffer-restore-fixup branch April 5, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants