Files
sshtermy/third_party/vt/csi.go
T
db9979andClaude Opus 5.5 2513a7818d MIT-Lizenz, weniger Speicher pro Tab, schnellere Ausgabe und Manager (#47)
* MIT-Lizenz; Terminal-Verlauf kompakt, schnellerer Bildlauf, Manager mit vielen Verbindungen schneller

- LICENSE (MIT), winget/Homebrew/apt-Metadaten, README, Webseite, --version
- termemu: Verlauf mit 8 statt 112 Byte pro Zeichen, Ringpuffer
- third_party/vt: angepasste Kopie (rotateLines, SetScrollbackHook)
- Store: Connections() zwischengespeichert; Manager: buildRows ohne Teillisten,
  Fußzeile misst Breiten einmal
- Benchmarks: make bench

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018i4GUjBAAPCAZVnGzCZxdS

* Testprogramm aus dem Commit entfernt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018i4GUjBAAPCAZVnGzCZxdS

* Testprogramm entfernt, *.test ignorieren

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018i4GUjBAAPCAZVnGzCZxdS

* TestSerialSession: auf stehenden Prompt warten statt auf das erste #

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018i4GUjBAAPCAZVnGzCZxdS

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-06 10:02:26 +01:00

56 lines
1.1 KiB
Go

package vt
import (
"fmt"
"io"
"strings"
"github.com/charmbracelet/x/ansi"
)
func (e *Emulator) handleCsi(cmd ansi.Cmd, params ansi.Params) {
e.flushGrapheme() // Flush any pending grapheme before handling CSI sequences.
if !e.handlers.handleCsi(cmd, params) {
e.logf("unhandled sequence: CSI %q", paramsString(cmd, params))
}
}
func (e *Emulator) handleRequestMode(params ansi.Params, isAnsi bool) {
n, _, ok := params.Param(0, 0)
if !ok || n == 0 {
return
}
var mode ansi.Mode = ansi.DECMode(n)
if isAnsi {
mode = ansi.ANSIMode(n)
}
setting := e.modes[mode]
_, _ = io.WriteString(e.pw, ansi.ReportMode(mode, setting))
}
func paramsString(cmd ansi.Cmd, params ansi.Params) string {
var s strings.Builder
if mark := cmd.Prefix(); mark != 0 {
s.WriteByte(mark)
}
params.ForEach(-1, func(i, p int, more bool) {
fmt.Fprintf(&s, "%d", p)
if i < len(params)-1 {
if more {
s.WriteByte(':')
} else {
s.WriteByte(';')
}
}
})
if inter := cmd.Intermediate(); inter != 0 {
s.WriteByte(inter)
}
if final := cmd.Final(); final != 0 {
s.WriteByte(final)
}
return s.String()
}