Files
sshtermy/third_party/vt/focus.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

30 lines
603 B
Go

package vt
import (
"io"
"github.com/charmbracelet/x/ansi"
)
// Focus sends the terminal a focus event if focus events mode is enabled.
// This is the opposite of [Blur].
func (e *Emulator) Focus() {
e.focus(true)
}
// Blur sends the terminal a blur event if focus events mode is enabled.
// This is the opposite of [Focus].
func (e *Emulator) Blur() {
e.focus(false)
}
func (e *Emulator) focus(focus bool) {
if mode, ok := e.modes[ansi.ModeFocusEvent]; ok && mode.IsSet() {
if focus {
_, _ = io.WriteString(e.pw, ansi.Focus)
} else {
_, _ = io.WriteString(e.pw, ansi.Blur)
}
}
}