Skip to content

Compute foreground and background colours for setEnabled and setEditable in StyledText#3154

Open
elsazac wants to merge 1 commit intoeclipse-platform:masterfrom
elsazac:StyledTextenhancement
Open

Compute foreground and background colours for setEnabled and setEditable in StyledText#3154
elsazac wants to merge 1 commit intoeclipse-platform:masterfrom
elsazac:StyledTextenhancement

Conversation

@elsazac
Copy link
Copy Markdown
Member

@elsazac elsazac commented Mar 27, 2026

This PR adds consistent handling of both foreground and background colors for both setEnabled and setEditable functions

The foreground and background colors were computed only for setEnabled. This has to be done for setEditable as
well to achieve consistency. Both the functions setEditable and setEnabled now recomputes foreground and background colour (earlier only applied in setEnabled)
This commit also adds a distinct foreground and background colour combination. Earlier the editable and non-editable state showed no difference. This now improves visual differentiation in StyledText.

Test Snippet : Test.txt

The StyledText behaviour in non editable state is shown below :

Before :
image

After :
image

Fixes: #3132, Fixes: #230

@elsazac elsazac force-pushed the StyledTextenhancement branch from 8363d1c to 18583c9 Compare March 27, 2026 15:03
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

Test Results

  170 files  ±0    170 suites  ±0   26m 4s ⏱️ -25s
4 679 tests ±0  4 658 ✅ ±0   21 💤 ±0  0 ❌ ±0 
6 592 runs  ±0  6 437 ✅ ±0  155 💤 ±0  0 ❌ ±0 

Results for commit c041cce. ± Comparison against base commit 1a5fdc6.

♻️ This comment has been updated with latest results.

@elsazac elsazac force-pushed the StyledTextenhancement branch 2 times, most recently from 67d983f to d4c145b Compare March 30, 2026 06:20
@BeckerWdf
Copy link
Copy Markdown
Member

Does this still work fine when CSS styling is used in the IDE?

@sratz
Copy link
Copy Markdown
Member

sratz commented Mar 30, 2026

This is going to resolve, #230, correct?

@iloveeclipse iloveeclipse requested a review from Copilot March 30, 2026 07:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes StyledText apply consistent foreground/background color recomputation for both setEnabled(...) and setEditable(...), and introduces a distinct visual style for the non-editable (but enabled) state.

Changes:

  • Added a shared updateColors(enabled, editable) helper and invoked it from both setEnabled and setEditable.
  • Introduced new system color choices for the enabled-but-non-editable state to improve visual differentiation.
  • Guarded resetCache(...) / caret recomputation in setBackground/setForeground when content is not yet initialized.

@elsazac elsazac force-pushed the StyledTextenhancement branch from d4c145b to e2635ea Compare March 30, 2026 09:57
@elsazac
Copy link
Copy Markdown
Member Author

elsazac commented Mar 30, 2026

Both editable and enabled are true :

Screenshot 2026-03-30 at 3 21 51 PM

When editable is true and enabled is false :

image

When editable is false and enabled is true :

image

when editable and enabled are both false :

image

@elsazac
Copy link
Copy Markdown
Member Author

elsazac commented Mar 30, 2026

This is going to resolve, #230, correct?

The enabled case wasn’t handled earlier, but it is now covered with most recent changes
Screenshot 2026-03-30 at 3 30 10 PM

@elsazac elsazac force-pushed the StyledTextenhancement branch 8 times, most recently from 97b2bf8 to 5e13521 Compare April 6, 2026 13:22
This commit adds the foreground and background color computation for
setEditable. Earlier this was handled only for setEnabled. This commit
also adds a different foreground and background color for StyledText
when background is not editable.

Fixes :eclipse-platform#3132
@elsazac elsazac force-pushed the StyledTextenhancement branch from 5e13521 to c041cce Compare April 6, 2026 13:23
@elsazac
Copy link
Copy Markdown
Member Author

elsazac commented Apr 6, 2026

Does this still work fine when CSS styling is used in the IDE?

It should work as expected because there is no additional modifications that have been made differently in terms of implementation.

@elsazac
Copy link
Copy Markdown
Member Author

elsazac commented Apr 7, 2026

Build looks good;
I would like to merge this by EOD if there are no outstanding concerns on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants