💡 Targeted SGR channel resets instead of a blanket reset

Abierto Apto para principiantes
#61 0 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
76/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
c, typescript
Área
cli, performance

Línea de trabajo

Empieza por src/clayterm.c:90 en emit_attr, especialmente el restablecimiento general en :95 y la emisión de primer plano/fondo en :114/:125. Ejecuta test/targeted-sgr-resets.test.ts o inspecciona la reproducción vinculada para establecer la salida actual. Se considera terminado cuando los canales modificados usan restablecimientos predeterminados específicos, los canales sin cambios permanecen intactos y la prueba pasa.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

Is your feature request related to a problem?

On every attribute change, the renderer tears down all SGR state with a blanket \x1b[0m before re-emitting, instead of resetting only the channel that changed (fg vs bg). A red-background cell followed by a default cell generates ...\x1b[48;2;255;0;0mA\x1b[0m... rather than a clean \x1b[49m, resulting in more bytes to process and unnecessary broken foreground sections.

Describe the solution you'd like

Diff the previous and current cell per channel and emit targeted resets when that channel actually changes: \x1b[39m to return the foreground to default, \x1b[49m for the background. Unchanged channels should remain intact across the run. The visible result is identical; the output is smaller and color runs stay continuous.

Describe alternatives you've considered

Keeping the blanket reset and trimming elsewhere doesn't help—the reset is exactly what forces the re-emit. The per-channel diff has to live in emit_attr, alongside the lastfg/lastbg state it already tracks.

Additional context

Failing test case on nm/repro/targeted-sgr-resets (test · diff).

The change likely lives in emit_attr (src/clayterm.c:90)—the blanket reset at :95, foreground/background emit at :114/:125.

Lenguaje dominante
TypeScript
Estrellas
42
Forks
2
Merge medio
2 d 5 h
PR fusionados (30 d)
12

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de bombshell-dev/tty

Todos los issues de bombshell-dev/tty

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.