Skip to content

Fix TextInputNode placeholder not respecting configured background color#233

Merged
Aaronontheweb merged 3 commits into
Aaronontheweb:devfrom
jsantos98:fix/textinput-placeholder-background
May 29, 2026
Merged

Fix TextInputNode placeholder not respecting configured background color#233
Aaronontheweb merged 3 commits into
Aaronontheweb:devfrom
jsantos98:fix/textinput-placeholder-background

Conversation

@jsantos98

@jsantos98 jsantos98 commented May 27, 2026

Copy link
Copy Markdown
Contributor

Problem

When a Background color is configured on TextInputNode (e.g. for a styled command panel), the placeholder text renders with the terminal's default background instead of the configured one. This creates a visual inconsistency — the input area has the correct background when text is present, but shows the wrong background when only the placeholder is displayed.

Fix

Two changes in TextInputNode.Render:

  1. Fill the input area with the configured background before rendering any content (text, cursor, placeholder). This ensures the entire input bounds have the correct background.
  2. Set background before writing placeholder text so the placeholder glyphs display against the configured background.

Testing

Verified in the Zerix CLI project where TextInputNode is used with Background = AppTheme.CommandPanelBackground (#333842). The placeholder now correctly renders with the panel background color instead of the terminal default.

jsantos98 and others added 2 commits May 27, 2026 15:09
When a Background color is configured on TextInputNode, the placeholder
text now renders with the correct background fill instead of inheriting
the terminal's default background.

Two changes:
- Fill the input area with the configured background before rendering
  any content (text, cursor, placeholder).
- Set background before writing placeholder text so it displays
  correctly against the configured background.
Asserts (via VirtualTerminal.GetBackground) that a configured Background is
applied to both the placeholder glyph cells and the trailing empty cells, and
that cells stay default when no Background is set.

@Aaronontheweb Aaronontheweb left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Verified against the render-context semantics: both edits are required (after the up-front Fill the code calls ResetColors(), and WriteAt stamps the current bg per cell, so the placeholder write must re-set Background). The up-front Fill also correctly covers trailing empty cells, so the whole input region now shows the configured background — a slightly broader (and desirable) fix than the title suggests.

Pushed render regression tests (commit d974000) using VirtualTerminal.GetBackground to assert placeholder + trailing cells get the configured bg, and stay default when none is set.

No public API change (method-body only). LGTM.

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) May 29, 2026 02:26
@Aaronontheweb Aaronontheweb disabled auto-merge May 29, 2026 14:44
@Aaronontheweb

Copy link
Copy Markdown
Owner

This looks good @jsantos98 - thank you. Please consider configuring your git setup with commit signature verification https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification

@Aaronontheweb Aaronontheweb merged commit d82c2cd into Aaronontheweb:dev May 29, 2026
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.

2 participants