fix(tui): track rendered spaces for selection copy

- add a written-cell bitmap so selection can distinguish rendered spaces from blank padding
- preserve code indentation without markdown-specific rendering hacks
This commit is contained in:
Brooklyn Nicholson 2026-04-25 15:21:26 -05:00
parent 1735ced93b
commit bd66e55a02
4 changed files with 57 additions and 28 deletions

View file

@ -12,7 +12,7 @@
import { clamp } from './layout/geometry.js'
import type { Screen, StylePool } from './screen.js'
import { cellAt, cellAtIndex, CellWidth, isEmptyCellAt, setCellStyleId } from './screen.js'
import { cellAt, cellAtIndex, CellWidth, isWrittenCellAt, setCellStyleId } from './screen.js'
type Point = { col: number; row: number }
@ -847,7 +847,7 @@ function selectableCell(screen: Screen, row: number, col: number): boolean {
return (
screen.noSelect[row * screen.width + col] !== 1 &&
!isEmptyCellAt(screen, col, row) &&
isWrittenCellAt(screen, col, row) &&
!!cell &&
cell.width !== CellWidth.SpacerTail &&
cell.width !== CellWidth.SpacerHead