feat(tui): uniform selection background instead of SGR inverse

Selection was falling back to SGR-7 inverse (fg ↔ bg per cell), which
fragments over syntax-highlighted content — each amber/gold/dim/cornsilk
fg turned into a different bg stripe, producing the staircase look.

Now `useMainApp` calls `selection.setSelectionBgColor()` with a muted
navy (`#3a3a55`) on theme change. `setSelectionBg` in screen.ts replaces
just the bg cell-by-cell while preserving fg/bold/dim/italic, so the
highlight is one solid color across the whole drag range and the text
stays readable in its original color.

Skins can override via `selection_bg` in their color map.
This commit is contained in:
Brooklyn Nicholson 2026-04-16 15:50:28 -05:00
parent 9503896aa2
commit 275256cdb4
2 changed files with 16 additions and 0 deletions

View file

@ -19,6 +19,8 @@ export interface ThemeColors {
statusBad: string
statusCritical: string
selectionBg: string
diffAdded: string
diffRemoved: string
diffAddedWord: string
@ -94,6 +96,11 @@ export const DEFAULT_THEME: Theme = {
statusBad: '#FF8C00',
statusCritical: '#FF6B6B',
// Uniform selection bg — matches the muted navy of the status bar so
// gold/amber fg stays readable and the highlight doesn't fragment per
// fg color the way SGR-inverse does.
selectionBg: '#3a3a55',
diffAdded: 'rgb(220,255,220)',
diffRemoved: 'rgb(255,220,220)',
diffAddedWord: 'rgb(36,138,61)',
@ -149,6 +156,8 @@ export function fromSkin(
statusBad: d.color.statusBad,
statusCritical: d.color.statusCritical,
selectionBg: c('selection_bg') ?? d.color.selectionBg,
diffAdded: d.color.diffAdded,
diffRemoved: d.color.diffRemoved,
diffAddedWord: d.color.diffAddedWord,