Add UseThemeBackground property to Editor#81
Conversation
When true (the default), syntax-highlighted tokens use the base Normal background instead of the background supplied by the syntax highlighter, so the editor blends into the surrounding theme. Fixes the issue where the editor background was inconsistent with the theme's Normal background when syntax highlighting was active. Agent-Logs-Url: https://github.com/gui-cs/Text/sessions/30aff306-af60-4170-890c-2cde2267ebef Co-authored-by: tig <585482+tig@users.noreply.github.com>
|
Add an options menu to Ted for this setting. Default should be checked. |
Agent-Logs-Url: https://github.com/gui-cs/Text/sessions/30aff306-af60-4170-890c-2cde2267ebef Co-authored-by: tig <585482+tig@users.noreply.github.com>
|
@copilot Add an options menu to Ted for this setting. Default should be checked. |
UseThemeBackground property to Editor
Adds a checked checkbox in Options > Use Theme Background that toggles Editor.UseThemeBackground. Default is checked (true). Agent-Logs-Url: https://github.com/gui-cs/Text/sessions/04a93e8d-10c9-429a-888b-170fdd5fa584 Co-authored-by: tig <585482+tig@users.noreply.github.com>
|
@copilot I think you have the logic backwards. And when (using current logic) it's unchecked, it is not using the correct background. See image.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d4ee72566
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
UseThemeBackground=true now means "use the syntax highlighting theme's background" (e.g. Dark Plus #1E1E1E), matching Terminal.Gui's Markdown view convention. When true, the viewport is also filled with the highlighter's DefaultBackground so empty cells match. UseThemeBackground=false overrides the highlighter's background with the TG scheme's Normal background. Also switches ted's menu item to the Action pattern (matching lineNumbersCheckBox) for reliable toggle behavior. Agent-Logs-Url: https://github.com/gui-cs/Text/sessions/cef8e227-1d3b-4069-8f43-f532a295fc69 Co-authored-by: tig <585482+tig@users.noreply.github.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
@copilot make sure you do code cleanup on the code you touched. |
…Rune Agent-Logs-Url: https://github.com/gui-cs/Text/sessions/cef8e227-1d3b-4069-8f43-f532a295fc69 Co-authored-by: tig <585482+tig@users.noreply.github.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Fixed in 6715c7a. The logic was indeed backwards — I had the semantics inverted from TG's Markdown convention. Now:
Also switched the menu item to the |
Ran both Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|

Syntax-highlighted tokens carry their own background color (e.g. Dark Plus's
#1E1E1E), which conflicts with the active TG theme's Normal background — visible as mismatched backgrounds in themes like Anders.Adds
UseThemeBackground(defaulttrue) matching the semantics of TG's Markdown View: when enabled, highlighted tokens keep both their foreground and background from the syntax highlighting theme, and the viewport is filled withISyntaxHighlighter.DefaultBackgroundso empty cells are consistent. When disabled, the highlighter's background is overridden with the TG scheme's Normal background.Editor.cs— NewUseThemeBackgroundproperty; invalidates visual-line caches and redraws on change. Passes value through toVisualLineBuildContext.Editor.Drawing.cs— NewFillViewportBackgroundmethod fills the viewport withISyntaxHighlighter.DefaultBackgroundwhenUseThemeBackgroundis true, ensuring empty cells match per-token backgrounds.VisualLineBuildContext.cs— NewUseThemeBackgroundparameter/property.VisualLineBuilder.cs—GetAttributereplaces styled-segment background withNormalAttribute.BackgroundwhenUseThemeBackgroundis false (i.e., user opts out of the syntax theme's background).EditorRenderingTests.cs— Three new tests covering default value, background override (false), and preservation (true).TedApp.cs— Added "Use Theme Background" checkbox to the Options menu (checked by default), togglingEditor.UseThemeBackgroundvia the Action pattern.