@@ -477,6 +477,13 @@ function paintTextInput(
477477 const ch = Math.max(0, h - padY * 2);
478478 if (cw <= 0 || ch <= 0) return;
479479
480+ // Fill the TextInput rect with background color (like containers do)
481+ // so that cursor inversion and empty cells have correct colors.
482+ const effectiveBg = props.bgColor ?? inherited.bgColor;
483+ if (effectiveBg) {
484+ fillBackground(rect, clipRect, effectiveBg, buf);
485+ }
486+
480487 const value = props.value;
481488 const showPlaceholder = value.length === 0 && props.placeholder;
482489
@@ -537,6 +544,41 @@ function paintTextInput(
537544 const line = lines[lineIdx]!;
538545 paintLineGraphemes(line, cx, cy + row, cw, clipRect, props, buf);
539546 }
547+
548+ // Paint cursor if focused — invert colors at cursor position so it's
549+ // always visible regardless of terminal cursor configuration. The
550+ // framework also positions the native terminal cursor here (in cel.ts)
551+ // for blinking.
552+ if (props.focused) {
553+ const cursorOffset = getTextInputCursor(props);
554+ const pos = offsetToWrappedPos(value, cursorOffset, cw);
555+ const screenRow = pos.line - scrollOffset;
556+ if (screenRow >= 0 && screenRow < ch && pos.col < cw) {
557+ const absX = cx + pos.col;
558+ const absY = cy + screenRow;
559+ if (
560+ absX >= clipRect.x &&
561+ absX < clipRect.x + clipRect.width &&
562+ absY >= clipRect.y &&
563+ absY < clipRect.y + clipRect.height
564+ ) {
565+ const existing = buf.get(absX, absY);
566+ // Resolve null colors against inherited style so the inversion
567+ // always produces visible contrast (e.g. on bg-filled empty cells
568+ // where fgColor is null).
569+ const resolvedFg = existing.fgColor ?? inherited.fgColor ?? "color07";
570+ const resolvedBg = existing.bgColor ?? inherited.bgColor ?? "color00";
571+ buf.set(absX, absY, {
572+ char: existing.char,
573+ fgColor: resolvedBg,
574+ bgColor: resolvedFg,
575+ bold: existing.bold,
576+ italic: existing.italic,
577+ underline: existing.underline,
578+ });
579+ }
580+ }
581+ }
540582 }
541583
542584 /**