mirror of
https://github.com/db9979/sshtermy.git
synced 2026-12-06 04:34: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>
83 lines
1.6 KiB
Go
83 lines
1.6 KiB
Go
package ansi
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/charmbracelet/x/ansi/parser"
|
|
)
|
|
|
|
func TestDcsSequence(t *testing.T) {
|
|
cases := []testCase{
|
|
{
|
|
name: "max_params",
|
|
input: fmt.Sprintf("\x1bP%sp\x1b\\", strings.Repeat("1;", 33)),
|
|
expected: []any{
|
|
dcsSequence{
|
|
Cmd: 'p',
|
|
Params: Params{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
|
Data: []byte{},
|
|
},
|
|
Cmd('\\'),
|
|
},
|
|
},
|
|
{
|
|
name: "reset",
|
|
input: "\x1b[3;1\x1bP1$tx\x9c",
|
|
expected: []any{
|
|
dcsSequence{
|
|
Cmd: 't' | '$'<<parser.IntermedShift,
|
|
Params: Params{1},
|
|
Data: []byte{'x'},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
name: "parse",
|
|
input: "\x1bP0;1|17/ab\x9c",
|
|
expected: []any{
|
|
dcsSequence{
|
|
Cmd: '|',
|
|
Params: Params{0, 1},
|
|
Data: []byte("17/ab"),
|
|
},
|
|
},
|
|
},
|
|
{
|
|
name: "intermediate_reset_on_exit",
|
|
input: "\x1bP=1sZZZ\x1b+\x5c",
|
|
expected: []any{
|
|
dcsSequence{
|
|
Cmd: 's' | '='<<parser.PrefixShift,
|
|
Params: Params{1},
|
|
Data: []byte("ZZZ"),
|
|
},
|
|
Cmd(0x5c | '+'<<parser.IntermedShift),
|
|
},
|
|
},
|
|
{
|
|
name: "put_utf8",
|
|
input: "\x1bP+r😃\x1b\\",
|
|
expected: []any{
|
|
dcsSequence{
|
|
Cmd: 'r' | '+'<<parser.IntermedShift,
|
|
Params: Params{},
|
|
Data: []byte("😃"),
|
|
},
|
|
Cmd('\\'),
|
|
},
|
|
},
|
|
}
|
|
|
|
for _, c := range cases {
|
|
t.Run(c.name, func(t *testing.T) {
|
|
dispatcher := &testDispatcher{}
|
|
parser := testParser(dispatcher)
|
|
parser.Parse([]byte(c.input))
|
|
assertEqual(t, len(c.expected), len(dispatcher.dispatched))
|
|
assertEqual(t, c.expected, dispatcher.dispatched)
|
|
})
|
|
}
|
|
}
|