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

@ -130,6 +130,13 @@ export function useMainApp(gw: GatewayClient) {
const hasSelection = useHasSelection()
const selection = useSelection()
// Bind a uniform selection bg so drag-to-select shows one solid color
// across the whole range instead of SGR-inverse (which swaps each cell's
// fg → bg and fragments over amber/gold/dim text). Re-fires on skin swap.
useEffect(() => {
selection.setSelectionBgColor(ui.theme.color.selectionBg)
}, [selection, ui.theme.color.selectionBg])
const composer = useComposerState({
gw,
onClipboardPaste: quiet => clipboardPasteRef.current(quiet),