mirror of
https://github.com/db9979/sshtermy.git
synced 2026-12-06 12:44:08 +01:00
* Leistungsanzeige verständlicher, Zeichnen etwa doppelt so schnell - Anzeige bewertet die Zeichenzeit in Worten (flüssig/gut/etwas träge/ruckelt), zwei Zeilen Balken je Bild statt Braille-Punkte, "möglich"-Bildrate, 1 Bild/s im Leerlauf wird erklärt; im Terminal links neben der F6-Leiste, Toasts weichen darunter aus - Overlays (Toasts, Tooltip, Ausblenden, Leistungsanzeige) ohne Compositor: stamp() fasst nur die überdeckten Zeilen an - Terminalbild wird gemerkt, solange keine neue Ausgabe kam (Term.Gen) - Seitenleiste ohne lipgloss-Umbruch anfügen (beside), Verläufe in einem Render - ViewHL misst bereits aufgefüllte Zeilen nicht noch einmal - Benchmarks: Terminal 2,9 → 0,9 ms, mit F6 + Anzeige 6,5 → 2,3 ms, mit laufender Ausgabe 6,9 → 3,5 ms je Bild Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUk5KxaHH89KrFPon9n * Zeichnen noch einmal fast doppelt so schnell - x/ansi als Fork (third_party/ansi): ASCII-Schnellweg in FirstGraphemeCluster, lipgloss misst jede Zeile jedes Bildes - Terminal-Zeilen unter einer Sperre holen (vt LineCopy), Farbregeln aus denselben Zellen statt jede Zelle zweimal einzeln - Seitenleiste (F6, Ziel, …) gemerkt, solange ihr Inhalt gleich bleibt - Balken der Leistungsanzeige je Farbe in einem Render - Benchmark mit F6, Anzeige und laufender Ausgabe: 3,5 → 1,8 ms je Bild Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUk5KxaHH89KrFPon9n --------- Co-authored-by: Claude <noreply@anthropic.com>
57 lines
1.2 KiB
Go
57 lines
1.2 KiB
Go
package termemu
|
|
|
|
import (
|
|
"image/color"
|
|
|
|
uv "github.com/charmbracelet/ultraviolet"
|
|
|
|
"github.com/db9979/sshtermy/internal/highlight"
|
|
)
|
|
|
|
// HL: Farbregeln beim Zeichnen. Set liefert die Bereiche pro Zeile,
|
|
// Colors die Farbe des Themes je Bedeutung (Index = highlight.Color).
|
|
type HL struct {
|
|
Set *highlight.Set
|
|
Colors [8]color.Color
|
|
}
|
|
|
|
// columns: Farbe je Spalte der Zeile l (nil = keine Regel).
|
|
func (hl *HL) columns(t *Term, sb, w, l int) []color.Color {
|
|
if hl == nil || hl.Set == nil {
|
|
return nil
|
|
}
|
|
line := make(uv.Line, w)
|
|
t.lineCells(sb, l, line)
|
|
return hl.columnsOf(line)
|
|
}
|
|
|
|
// columnsOf: wie columns, für eine schon geholte Zeile.
|
|
func (hl *HL) columnsOf(line uv.Line) []color.Color {
|
|
if hl == nil || hl.Set == nil {
|
|
return nil
|
|
}
|
|
w := len(line)
|
|
text, cols := cellsText(line)
|
|
spans := hl.Set.Spans(text)
|
|
if len(spans) == 0 {
|
|
return nil
|
|
}
|
|
out := make([]color.Color, w)
|
|
for _, sp := range spans {
|
|
c := hl.Colors[sp.Color]
|
|
if c == nil || sp.Start >= len(cols) {
|
|
continue
|
|
}
|
|
from := cols[sp.Start]
|
|
to := cols[min(sp.End, len(cols))-1]
|
|
for x := from; x <= to && x < w; x++ {
|
|
out[x] = c
|
|
}
|
|
// breites letztes Zeichen: auch die zweite Zelle
|
|
if to+1 < w && line[to].Width > 1 {
|
|
out[to+1] = c
|
|
}
|
|
}
|
|
return out
|
|
}
|