Skip to content

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

Merged
elsazac merged 1 commit intoeclipse-platform:masterfrom
elsazac:StyledTextenhancement
Apr 8, 2026
Merged

Compute foreground and background colours for setEnabled and setEditable in StyledText#3154
elsazac merged 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 6s ⏱️ - 1m 54s
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 3b33c43. ± Comparison against base commit 8e9c223.

♻️ 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 9 times, most recently 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.

@elsazac elsazac force-pushed the StyledTextenhancement branch 5 times, most recently from 99d8daa to 92bcd29 Compare April 8, 2026 08:30
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Test Results (macos)

   53 files   -     1     53 suites   - 1   5m 2s ⏱️ - 2m 53s
4 531 tests ±    0  4 287 ✅ ±  0  244 💤 ± 0  0 ❌ ±0 
1 117 runs   - 1 013  1 086 ✅  - 982   31 💤  - 31  0 ❌ ±0 

Results for commit 92bcd29. ± Comparison against base commit cad012b.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Test Results (linux)

   56 files   -    32     56 suites   - 32   4m 2s ⏱️ - 10m 27s
4 557 tests ±    0  4 337 ✅ ±    0  220 💤 ± 0  0 ❌ ±0 
1 161 runs   - 2 114  1 146 ✅  - 2 060   15 💤  - 54  0 ❌ ±0 

Results for commit 92bcd29. ± Comparison against base commit cad012b.

@elsazac
Copy link
Copy Markdown
Member Author

elsazac commented Apr 8, 2026

I found an issue with testing in light theme, so updated changes accordingly. Attaching the screenshots for both light and dark theme here.

Both editable and enabled are true :

Screenshot 2026-04-08 at 12 15 18 PM Screenshot 2026-04-08 at 12 19 09 PM

When editable is true and enabled is false :

Screenshot 2026-04-08 at 12 15 26 PM Screenshot 2026-04-08 at 12 19 16 PM

When editable is false and enabled is true :

Screenshot 2026-04-08 at 12 15 38 PM Screenshot 2026-04-08 at 12 19 28 PM

when editable and enabled are both false :

Screenshot 2026-04-08 at 12 15 45 PM Screenshot 2026-04-08 at 12 19 38 PM

Snippet from #230 :

Screenshot 2026-04-08 at 12 16 15 PM Screenshot 2026-04-08 at 12 19 53 PM

@SougandhS
Copy link
Copy Markdown

I found an issue with testing in light theme, so updated changes accordingly. Attaching the screenshots for both light and dark theme here.

New colours looks great !

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 92bcd29 to 3b33c43 Compare April 8, 2026 09:51
@elsazac
Copy link
Copy Markdown
Member Author

elsazac commented Apr 8, 2026

Merging this now;

@elsazac elsazac merged commit 52b0611 into eclipse-platform:master Apr 8, 2026
24 checks passed
@elsazac elsazac self-assigned this Apr 8, 2026
@elsazac elsazac added this to the 4.40 M2 milestone Apr 8, 2026
@HeikoKlare
Copy link
Copy Markdown
Contributor

This might have caused a regression: #3207

@BeckerWdf
Copy link
Copy Markdown
Member

I think we should revert and work on a proper rework of this without a hurry.

@akurtakov
Copy link
Copy Markdown
Member

This PR also makes cursor invisible on Gtk4.

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

Labels

None yet

Projects

None yet

7 participants