Skip to content

Copy HTML version of the selection info#4140

Merged
alex-w merged 1 commit intomasterfrom
clipboard-html
Feb 18, 2025
Merged

Copy HTML version of the selection info#4140
alex-w merged 1 commit intomasterfrom
clipboard-html

Conversation

@10110111
Copy link
Copy Markdown
Contributor

In addition to current plain text being copied into clipboard on Ctrl+Shift+C, this patch also provides an HTML version, so that one could paste it e.g. into LibO Writer and get bold fonts, subscripts etc.

I'm not sure though that we want to keep the text color. It's very pale when pasted into LibO Writer with white background, but OTOH, I remember that copying from web browser also preserves the colors. We don't specify the font explicitly though, so it doesn't match after pasting. If we preserve the color, maybe we could wrap the HTML into one more <font> tag for font name.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • This change requires a documentation update
  • Housekeeping

How Has This Been Tested?

Test Configuration:

  • Operating system: Ubuntu 20.04
  • Graphics Card: Intel UHD Graphics 620

Checklist:

  • My code follows the code style of this project.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (header file)
  • I have updated the respective chapter in the Stellarium User Guide
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@github-actions
Copy link
Copy Markdown

Great PR! Please pay attention to the following items before merging:

Files matching src/**/*.cpp:

  • Are possibly unused includes removed?

This is an automatically generated QA checklist based on modified files.

@alex-w alex-w added this to the 25.1 milestone Feb 17, 2025
@alex-w
Copy link
Copy Markdown
Member

alex-w commented Feb 17, 2025

I’m not sure that this patch is necessary - why HTML formatted text is important for you?

@10110111
Copy link
Copy Markdown
Contributor Author

10110111 commented Feb 17, 2025

why HTML formatted text is important for you?

Because there are subscripts that are lost on toPlainText(), which is not nice. I mean the characters are preserved, but their formatting is lost.

@gzotti
Copy link
Copy Markdown
Member

gzotti commented Feb 17, 2025

HTML sounds nice to keep titles&subscripts, yes. But I'm also not sure about the color necessity. For stars the color is derived from B-V, or a custom color can override the automatically derived ones, ... probably "current color and current font" is enough for the editor (sorry, is "LibO==LibreOffice?) Or do you fear glyphs may get lost if font name is not given?

@alex-w
Copy link
Copy Markdown
Member

alex-w commented Feb 17, 2025

I think the text should be black :)

@10110111
Copy link
Copy Markdown
Contributor Author

is "LibO==LibreOffice?

Yes.

Or do you fear glyphs may get lost if font name is not given?

No, it's just a matter of completeness. Seems to make sense to preserve font if we do preserve colors. It's just a bit strange to see colored text that suddenly got serifs that weren't present in the Stellarium window.

I think the text should be black :)

Ideally, the color shouldn't be defined if we decide not to preserve the colors, so that the editor's current color could take effect.

@alex-w
Copy link
Copy Markdown
Member

alex-w commented Feb 17, 2025

Ideally, the color shouldn't be defined if we decide not to preserve the colors, so that the editor's current color could take effect.

Currently I see white text on white background - this is not very good combination for reading :)

@10110111
Copy link
Copy Markdown
Contributor Author

Currently I see white text on white background - this is not very good combination for reading :)

Sure, because we are preserving the colors. If we decide not to, we shouldn't force it to be black either, because it's not our design choice then, we should simply omit the font color and let the editor use what it would if you type. In the current case we could just strip color="#......" to achieve this.

@alex-w
Copy link
Copy Markdown
Member

alex-w commented Feb 17, 2025

Add stripping color data is good IMHO

In addition to current plain text being copied into clipboard on
Ctrl+Shift+C, this patch also provides an HTML version, so that one
could paste it e.g. into LibO Writer and get bold fonts, subscripts etc.
@alex-w alex-w merged commit 64f09a0 into master Feb 18, 2025
26 checks passed
@alex-w alex-w deleted the clipboard-html branch February 18, 2025 03:14
@alex-w alex-w added the state: published The fix has been published for testing in weekly binary package label Feb 24, 2025
@github-actions
Copy link
Copy Markdown

Hello @10110111!

Please check the fresh version (development snapshot) of Stellarium:
https://github.com/Stellarium/stellarium-data/releases/tag/weekly-snapshot

@alex-w alex-w removed the state: published The fix has been published for testing in weekly binary package label Mar 23, 2025
@github-actions
Copy link
Copy Markdown

Hello @10110111!

Please check the latest stable version of Stellarium:
https://github.com/Stellarium/stellarium/releases/latest

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.

3 participants