Refactor GenRTF() and GenHTML() to use shared components #4940

Closed
opened 2026-01-31 00:01:08 +00:00 by claunia · 2 comments
Owner

Originally created by @carlos-zamora on GitHub (Nov 12, 2019).

Originally assigned to: @carlos-zamora on GitHub.

Description of the new feature/enhancement

#3535 adds GenRTF() to enable RTF Copy. It has some parts that are very similar to GenHTML(), which makes sense. It'd be nice to find a way to refactor the code a bit to reuse some sections.

My concern is that we make find a bug and fix it in one and not the other.

Proposed technical implementation details (optional)

We could probably use a few helper methods to create a more distinct separation of HTML vs RTF specific portions. The overall architecture and flow of both functions are essentially the same. Maybe even add an enum?

Bonus points

Make GenHTML() noexcept too.

Originally created by @carlos-zamora on GitHub (Nov 12, 2019). Originally assigned to: @carlos-zamora on GitHub. # Description of the new feature/enhancement #3535 adds `GenRTF()` to enable RTF Copy. It has some parts that are _very_ similar to `GenHTML()`, which makes sense. It'd be nice to find a way to refactor the code a bit to reuse some sections. My concern is that we make find a bug and fix it in one and not the other. # Proposed technical implementation details (optional) We could probably use a few helper methods to create a more distinct separation of HTML vs RTF specific portions. The overall architecture and flow of both functions are essentially the same. Maybe even add an enum? # Bonus points `Make GenHTML()` noexcept too.
claunia added the Issue-TaskNeeds-Tag-FixProduct-TerminalArea-CodeHealth labels 2026-01-31 00:01:08 +00:00
Author
Owner

@carlos-zamora commented on GitHub (Jun 2, 2020):

@DHowett I was taking a closer look at the differences between GenRTF() and GenHTML(). Refactoring them would just make the code more difficult to understand and risks breaking something. Mind if I just close this issue?

@carlos-zamora commented on GitHub (Jun 2, 2020): @DHowett I was taking a closer look at the differences between `GenRTF()` and `GenHTML()`. Refactoring them would just make the code more difficult to understand and risks breaking something. Mind if I just close this issue?
Author
Owner

@DHowett commented on GitHub (Jun 2, 2020):

Go ahead!

@DHowett commented on GitHub (Jun 2, 2020): Go ahead!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4940