Files
sshtermy/internal/gui/cursor_test.go
T
db9979andClaude 9098de5953 Cursor in hellen Themes immer sichtbar (#156)
- Helle Themes zeichnen den Terminal-Cursor selbst als Block in Akzentfarbe
  und blenden den des Terminals aus: viele Terminals ignorieren OSC 12 und
  zeigen ihren weißen Cursor, der auf hellem Grund verschwindet.
- Suche im Terminal (Strg+F) bekam keine Theme-Stile: Cursor und Schrift
  waren für dunkle Terminals gefärbt.
- Eigenes Fenster: Cursor nicht mehr fest Weiß, sondern OSC 12 bzw.
  Schriftfarbe, mit Kontrastprüfung gegen den Zellgrund.
- Tests: Cursor-Kontrast aller Themes, Cursorzelle hell/dunkel, Suchfeld,
  OSC 12/112, Cursorfarbe im Fenster.


Claude-Session: https://claude.ai/code/session_018i4GUfxDiNEVu6fSfb4rAs

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-13 12:16:37 +01:00

29 lines
839 B
Go

//go:build windows || darwin || linux
package gui
import (
"image/color"
"testing"
)
// Der Cursor darf auf hellem Grund nicht verschwinden: ohne gemeldete Farbe
// gilt die Schrift, eine zu helle Meldung wird ersetzt.
func TestCursorColorVisible(t *testing.T) {
light := color.RGBA{0xf5, 0xf5, 0xf7, 0xff}
text := color.RGBA{0x1f, 0x23, 0x35, 0xff}
accent := color.RGBA{0x2e, 0x59, 0xc9, 0xff}
if got := cursorColor(nil, text, light); got != text {
t.Errorf("ohne OSC 12: %v", got)
}
if got := cursorColor(accent, text, light); got != accent {
t.Errorf("Akzent: %v", got)
}
if got := cursorColor(color.RGBA{0xff, 0xff, 0xff, 0xff}, text, light); got != text {
t.Errorf("Weiß auf Hell: %v", got)
}
if got := cursorColor(nil, defaultFg, defaultBg); lumaDiff(got, defaultBg) < 0.25 {
t.Errorf("Dunkel: %v", got)
}
}