Skip to content

Conversation

@akurtakov
Copy link
Member

The key is simply StyledText.getData
Let's have this one as hidden "gem" for testing purposes to ease both testing the implementation and may one day it would be worth exposing as proper API.

The key is simply StyledText.getData
Let's have this one as hidden "gem" for testing purposes to ease both
testing the implementation and may one day it would be worth exposing as
proper API.
@akurtakov akurtakov self-assigned this Sep 23, 2025
@BeckerWdf
Copy link
Member

Can you provide more context on this?

@github-actions
Copy link
Contributor

Test Results

  118 files  ±0    118 suites  ±0   11m 27s ⏱️ + 1m 21s
4 432 tests ±0  4 409 ✅  - 2  17 💤 ±0  6 ❌ +2 
  298 runs  ±0    288 ✅  - 2   4 💤 ±0  6 ❌ +2 

For more details on these failures, see this check.

Results for commit 0f986e1. ± Comparison against base commit 35119f0.

@akurtakov
Copy link
Member Author

@BeckerWdf Sure, one can do:

styledText.getData("StyledText.htmlText")

and will get html formatted text or the StyledText content the same as used for clipboard, e.g.

<span style='background-color:#ffffff;padding:0px 0px 0px 0px;'><span style='color:#000000;background-color:#ffffff;font-family:"Noto Sans";font-size:10pt;white-space:pre;'><span style='font-weight:bold;'>test</span></span></span>

@BeckerWdf
Copy link
Member

And what is this needed for? What's the bigger use case on that?

@akurtakov
Copy link
Member Author

Export content to html for saving purposes, debugging, enhancing clipboard operations/compatibility and so on development purposes. Html being defacto standard for rendering nowadays gives other opportunities for sure. Do you have concerns?

@akurtakov
Copy link
Member Author

Failing Windows tests are #2516

@mickaelistria
Copy link
Contributor

What about making it an official API method toHTML() ? I think such feature would deserve it, and there are already possible clients for it in eg copy-paste.

@akurtakov
Copy link
Member Author

I would rather have a cycle (or two) experimenting with it before exposing as API, IMO if/when it becomes API it needs tests and be sure that everything is properly exported.

@BeckerWdf
Copy link
Member

Do you have concerns?

No I don't. I am just curious.

I am asking my self where the formatting like background-color:#ffffff;padding:0px 0px 0px 0px; are coming from?

@akurtakov
Copy link
Member Author

FWIW, get/setData is the way to give access to SWT internals if/when they are either not ready or should not become API for some reason e.g.

, ,
dataDir = (String) display.getData(EDGE_USER_DATA_FOLDER);
, and so on.

@akurtakov
Copy link
Member Author

Do you have concerns?

No I don't. I am just curious.

I am asking my self where the formatting like background-color:#ffffff;padding:0px 0px 0px 0px; are coming from?

It's the "defaults" of styled text when no StyleRange overwrites it - white background, no padding. Whether it makes sense to have them or not, combine some of the spans and etc. are exactly the things which in order to improve we need easier way to test.
I'm merging this one as it's not adding public API and is truly just an enablement for further work.

@akurtakov akurtakov merged commit e665d7e into eclipse-platform:master Sep 23, 2025
15 of 17 checks passed
@github-project-automation github-project-automation bot moved this to Done in SWT work Sep 23, 2025
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