diff --git a/README.de.md b/README.de.md index 92d98aa..c0f1aa8 100644 --- a/README.de.md +++ b/README.de.md @@ -17,7 +17,7 @@ sshTermy ist eine schlanke Terminal-Anwendung (TUI, eine einzige Datei, ~9 MB, k - **echtem SSH-Terminal** (xterm-256color, Truecolor, vim/htop/tmux, Scrollback, Tabs, Jump-Host) - **Auto-Reconnect**: reißt die Leitung ab (WLAN, VPN, Standby), verbindet sshTermy die Sitzung von selbst neu, startet laufende Tunnel wieder und hängt tmux/screen wieder an (abschaltbar über die Palette). Nach **Ruhezustand oder Netzwechsel** (anderes WLAN, VPN an/aus) prüft sshTermy jede Leitung binnen Sekunden, statt auf den Keepalive-Ablauf zu warten; solange gar kein Netz da ist, wartet es, ohne Versuche zu verbrauchen - **Feste Sitzung** (Idee: Dominik Bornhäußer): pro Verbindung beim Verbinden immer in dieselbe tmux-/screen-Sitzung, auch von einem anderen Rechner aus. Laufen schon andere Sitzungen, fragt sshTermy, welche. Gleicher Sitzungsname in zwei Tabs oder auf zwei Rechnern = gespiegelter Bildschirm; „nur zuschauen“ hängt tmux schreibgeschützt an. Die Palette öffnet einen zweiten Tab zum Zuschauen oder kopiert einen `ssh … tmux attach -r`-Befehl für Kollegen. Nicht bei Switches, Telnet und Konsole. -- **Eigenes Fenster** (ohne Terminal): Doppelklick auf `sshtermy.exe` im Explorer, `sshTermy.app` auf dem Mac oder `sshtermy -window`, und sshTermy öffnet ein eigenes Fenster mit eingebauter Cascadia Mono samt Nerd-Font-Symbolen und Emoji. Bilder vom Server erscheinen pixelgenau, ins Fenster gezogene Dateien werden zum Hochladen angeboten, ⇧F10 holt einen Tab in ein zweites eigenes Fenster. Alle Tasten kommen an (Alt+⏎, ⇧F1 … ⇧F12, Strg+Leertaste), Strg+⇧V oder ⇧Einfg fügen ein (Windows auch Strg+V, Mac ⌘V), Strg + / Strg − / Strg 0 oder Strg + Mausrad ändern die Schriftgröße (wird gemerkt), F11 schaltet Vollbild um. Das Fenster startet standardmäßig im **Vollbild**; Palette › Einstellungen › „Fenster beim Start“ stellt auf maximiert oder „wie zuletzt“ um (Größe und Position werden gemerkt). Im Terminal gestartet läuft sshTermy wie bisher im Terminal; `-tui` erzwingt das +- **Eigenes Fenster** (ohne Terminal): Doppelklick auf `sshtermy.exe` im Explorer, `sshTermy.app` auf dem Mac oder `sshtermy -window`, und sshTermy öffnet ein eigenes Fenster mit eingebauter Cascadia Mono samt Nerd-Font-Symbolen und Emoji. Bilder vom Server erscheinen pixelgenau, ins Fenster gezogene Dateien werden zum Hochladen angeboten, ⇧F10 holt einen Tab in ein zweites eigenes Fenster (der Verlauf geht mit; Mausrad, ⇧Bild↑/⇧Bild↓, ⇧Pos1/⇧Ende blättern auch dort). Alle Tasten kommen an (Alt+⏎, ⇧F1 … ⇧F12, Strg+Leertaste), Strg+⇧V oder ⇧Einfg fügen ein (Windows auch Strg+V, Mac ⌘V), Strg + / Strg − / Strg 0 oder Strg + Mausrad ändern die Schriftgröße (wird gemerkt), F11 schaltet Vollbild um. Das Fenster startet standardmäßig im **Vollbild**; Palette › Einstellungen › „Fenster beim Start“ stellt auf maximiert oder „wie zuletzt“ um (Größe und Position werden gemerkt). Im Terminal gestartet läuft sshTermy wie bisher im Terminal; `-tui` erzwingt das - **Lokale Shell** (Alt+L): deine eigene PowerShell (Windows, über ConPTY), zsh oder bash (macOS/Linux) als Tab, mit KI-Hilfe, Ziel-/Agent-/Plan-Modus, geteilter Ansicht, Tabs und Sitzungsprotokoll. Gefahren-Check und Agent-Stufen gelten auch auf dem eigenen Rechner; der Agent legt seine Skripte in `~/.sshtermy-agent` ab. Oder als Verbindung speichern („Verbindung über: Lokal“) mit eigener Shell (`pwsh`, `cmd`, `wsl`, `bash -l` …) und Startordner - **PowerShell-Fernzugriff (WinRM)**: auf Windows-Server einloggen wie mit `Enter-PSSession`, ohne SSH auf dem Server („Verbindungsart: PowerShell“, Port 5985/5986). NTLM auch für Domänenkonten, Kerberos für Server ohne NTLM, Nachrichten über HTTP verschlüsselt, oder HTTPS; eigene Eingabezeile mit Verlauf, Tab-Ergänzung vom Server und mehrzeiliger Eingabe. Die KI schlägt PowerShell-Befehle vor, der Gefahren-Check nimmt die Windows-Regeln. Palette: `Enter-PSSession srv01` oder `winrm admin@srv01` - **Fehlerverzeihend im Alltag**: Strg+Q und das Schließen des Fensters fragen nach, wenn noch Verbindungen offen sind; Verbindung, Ordner oder Runbook löschen geht sofort, ein Hinweis bietet 10 Sekunden lang **Rückgängig** an (Strg+Z im Manager oder Klick); **Strg+T im Verbindungsformular testet** Erreichbarkeit, Host-Key und Anmeldung vor dem Speichern; fehlgeschlagene Verbindungen sagen **in Klartext**, was los ist und was hilft („Anmeldung abgelehnt“, „Keine Antwort von sw1:22 … VPN oder Jump-Host?“, `e` bearbeitet die Verbindung), der Originalfehler steht grau darunter. Zeigt ein Server einen **neuen Host-Key** (Neuinstallation, Werksreset), vergleicht `k` alten und neuen Fingerprint und übernimmt den neuen nach zweiter Bestätigung @@ -358,7 +358,7 @@ sshtermy mcp # MCP-Server für KI-Clients (stdin/stdout), siehe „ | | F9 / ⇧F1…F8 | Schnellbefehle: Liste / direkt ausführen (`{{name}}` im Befehl fragt nach einem Wert) | | | F10 | zurück zum Manager (Sitzungen laufen weiter) | | | ⇧F9 | Tastenzeile erklärt die Tasten des Bereichs | -| | ⇧F10 | Tab in ein eigenes Terminalfenster abtrennen (Windows Terminal/Konsole, Terminal.app/iTerm2, Linux-Terminals, tmux; im eigenen Fenster von sshTermy ein zweites eigenes Fenster); die Sitzung bleibt offen, Fenster schließen oder ⏎ holt sie zurück. Eigenes Terminal: `SSHTERMY_TERMINAL="kitty {cmd}"` | +| | ⇧F10 | Tab in ein eigenes Terminalfenster abtrennen (Windows Terminal/Konsole, Terminal.app/iTerm2, Linux-Terminals, tmux; im eigenen Fenster von sshTermy ein zweites eigenes Fenster); der Verlauf geht mit, dort lässt sich weiter zurückblättern; die Sitzung bleibt offen, Fenster schließen oder ⏎ holt sie zurück. Eigenes Terminal: `SSHTERMY_TERMINAL="kitty {cmd}"` | | | Mausrad / ⇧Bild↑ / ⇧Bild↓ / ⇧Pos1 / ⇧Ende | im Verlauf (5000 Zeilen je Tab) zurückblättern, seitenweise / an den Anfang / zurück nach unten; Esc führt auch nach unten. In der geteilten Ansicht blättert der Bereich unter der Maus; Programme, die die Maus selbst nutzen (tmux, mc): ⇧ + Mausrad. Vollbild-Programme (less, vim) bekommen die Tasten selbst. Für lange Dateien ist `less` oder der Betrachter (F5, Doppelklick) besser | | | Strg+F | im Verlauf suchen (Strg+E nur Fehlerzeilen, Tab Fehlerliste) | | | Strg+T | Aufteilung wählen: eine, zwei nebeneinander/untereinander, groß + zwei, drei, vier, sechs (Tasten 1…7); im Fenster ⇧+Pfeil Größe, `=` gleich groß, `z` Zoom, `d` andere abdunkeln, `w` Arbeitsplätze | diff --git a/README.md b/README.md index a9834d5..f3cc7f8 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ sshTermy is a lean terminal application (TUI, a single file, ~9 MB, no installer - **a real SSH terminal** (xterm-256color, truecolor, vim/htop/tmux, scrollback, tabs, jump hosts) - **Auto-reconnect**: if the line drops (Wi-Fi, VPN, standby), sshTermy reconnects the session by itself, restarts running tunnels and reattaches tmux/screen (can be turned off in the palette). After **sleep or a network change** (other Wi-Fi, VPN on/off) every line is checked within seconds instead of waiting for the keepalive timeout; while there is no network at all, sshTermy waits without using up its attempts - **Persistent session** (idea: Dominik Bornhäußer): per connection, always land in the same tmux/screen session on connect, even from another computer. Other sessions already running? sshTermy asks which one. Same session name in two tabs or on two computers = mirrored screen; "view only" attaches tmux read-only. The palette opens a second watching tab or copies an `ssh … tmux attach -r` command for colleagues. Not on switches, Telnet or console. -- **Own window** (no terminal needed): double-click `sshtermy.exe` in Explorer, open `sshTermy.app` on the Mac or run `sshtermy -window`, and sshTermy opens its own window with Cascadia Mono, Nerd Font symbols and emoji built in. Images from the server show pixel-perfect, files dragged onto the window are offered for upload, ⇧F10 moves a tab into a second window of its own. All keys arrive (Alt+⏎, ⇧F1 … ⇧F12, Ctrl+Space), Ctrl+⇧V or ⇧Insert paste (Windows also Ctrl+V, Mac ⌘V), Ctrl + / Ctrl − / Ctrl 0 or Ctrl + mouse wheel change the font size (remembered), F11 toggles full screen. The window starts in **full screen** by default; palette › Settings › “Window at startup” switches to maximized or “as last time” (size and position are remembered). Started from a terminal, sshTermy runs in that terminal as before; `-tui` forces it +- **Own window** (no terminal needed): double-click `sshtermy.exe` in Explorer, open `sshTermy.app` on the Mac or run `sshtermy -window`, and sshTermy opens its own window with Cascadia Mono, Nerd Font symbols and emoji built in. Images from the server show pixel-perfect, files dragged onto the window are offered for upload, ⇧F10 moves a tab into a second window of its own (it takes the scrollback along; mouse wheel, ⇧PgUp/⇧PgDn, ⇧Home/⇧End scroll there too). All keys arrive (Alt+⏎, ⇧F1 … ⇧F12, Ctrl+Space), Ctrl+⇧V or ⇧Insert paste (Windows also Ctrl+V, Mac ⌘V), Ctrl + / Ctrl − / Ctrl 0 or Ctrl + mouse wheel change the font size (remembered), F11 toggles full screen. The window starts in **full screen** by default; palette › Settings › “Window at startup” switches to maximized or “as last time” (size and position are remembered). Started from a terminal, sshTermy runs in that terminal as before; `-tui` forces it - **Local shell** (Alt+L): your own PowerShell (Windows, via ConPTY), zsh or bash (macOS/Linux) as a tab, with AI help, goal/agent/plan mode, split view, tabs and session log. Danger rules and agent levels apply on your own computer too; the agent drops its scripts in `~/.sshtermy-agent`. Or save it as a connection (“Connect via: Local”) with its own shell (`pwsh`, `cmd`, `wsl`, `bash -l` …) and start folder - **Remote PowerShell (WinRM)**: log into Windows servers like `Enter-PSSession`, without SSH on the server (“Connection type: PowerShell”, ports 5985/5986). NTLM also for domain accounts, Kerberos for servers without NTLM, messages encrypted over HTTP, or HTTPS; own input line with history, Tab completion via the server and multi-line input. The AI suggests PowerShell commands, danger rules for Windows apply. Palette: `Enter-PSSession srv01` or `winrm admin@srv01` - **Forgiving everyday use**: Ctrl+Q and closing the window ask first when connections are still open; deleting a connection, folder or runbook happens right away and a toast offers **undo** for 10 s (Ctrl+Z in the manager or click); **Ctrl+T in the connection form tests** reachability, host key and login before you save; failed connections say in **plain language** what's wrong and what helps (“Login rejected”, “No answer from sw1:22 … VPN or jump host?”, `e` edits the connection), the original error stays below in gray. If a server shows a **new host key** (reinstall, factory reset), `k` compares old and new fingerprint and accepts the new one after a second confirmation @@ -348,7 +348,7 @@ sshtermy mcp # MCP server for AI clients (stdin/stdout), see “sshT | | F9 / ⇧F1…F8 | quick commands: list / run directly (`{{name}}` in the command asks for a value) | | | F10 | back to the manager (sessions keep running) | | | ⇧F9 | key bar explains the keys of the current area | -| | ⇧F10 | move the tab to its own terminal window (Windows Terminal/console, Terminal.app/iTerm2, Linux terminals, tmux; in sshTermy's own window a second own window); the session stays open, closing the window or ⏎ brings it back. Own terminal: `SSHTERMY_TERMINAL="kitty {cmd}"` | +| | ⇧F10 | move the tab to its own terminal window (Windows Terminal/console, Terminal.app/iTerm2, Linux terminals, tmux; in sshTermy's own window a second own window); the scrollback goes along, so you can keep scrolling back there; the session stays open, closing the window or ⏎ brings it back. Own terminal: `SSHTERMY_TERMINAL="kitty {cmd}"` | | | mouse wheel / ⇧PgUp / ⇧PgDn / ⇧Home / ⇧End | scroll back in the scrollback (5000 lines per tab) page by page / to the start / back to the bottom; Esc also returns to the bottom. In split view the pane under the mouse scrolls; programs that use the mouse themselves (tmux, mc): ⇧ + wheel. Full-screen programs (less, vim) get the keys themselves. For long files `less` or the file viewer (F5, double-click) is the better choice | | | Ctrl+F | search the scrollback (Ctrl+E only error lines, Tab error list) | | | Ctrl+T | choose a layout: one, two side by side/stacked, large + two, three, four, six (keys 1…7); inside, ⇧+arrow resizes, `=` equal sizes, `z` zoom, `d` dim the others, `w` workspaces | diff --git a/internal/gui/scroll.go b/internal/gui/scroll.go new file mode 100644 index 0000000..6976df0 --- /dev/null +++ b/internal/gui/scroll.go @@ -0,0 +1,87 @@ +//go:build windows || darwin || linux + +package gui + +import ( + uv "github.com/charmbracelet/ultraviolet" + "github.com/db9979/sshtermy/internal/termemu" +) + +// Zurückblättern im zweiten eigenen Fenster (abgetrennter Tab, ⇧F10). +// Im Hauptfenster blättert sshTermy selbst (ui/scrollkeys.go); hier hängt +// das Fenster direkt am Server, also blättert es in seinem eigenen +// Verlauf: Mausrad (⇧ + Rad, wenn das Programm die Maus will), +// ⇧Bild↑/↓ seitenweise, ⇧Pos1 an den Anfang, ⇧Ende zurück nach unten. +// Jede andere Taste führt wieder nach unten. + +// canScroll: Rückblick ist nur im normalen Bildschirm sinnvoll. +func (w *window) canScroll() bool { return w.opts.attach && !w.term.AltScreen() } + +func (w *window) setScroll(n int) { + n = max(0, min(n, w.term.ScrollbackLen())) + if n != w.scroll { + w.scroll, w.forceDraw = n, true + } + w.sbSeen = w.term.ScrollbackLen() +} + +// scrollKey: ⇧Bild↑/↓, ⇧Pos1, ⇧Ende. true = verbraucht. +func (w *window) scrollKey(code rune, mod uv.KeyMod) bool { + if !w.canScroll() || mod != uv.ModShift { + return false + } + _, h := w.term.Size() + page := max(h-1, 1) + switch code { + case uv.KeyPgUp: + w.setScroll(w.scroll + page) + case uv.KeyPgDown: + w.setScroll(w.scroll - page) + case uv.KeyHome: + w.setScroll(w.term.ScrollbackLen()) + case uv.KeyEnd: + w.setScroll(0) + default: + return false + } + return true +} + +// localWheel: Das Rad blättert im Fenster selbst, statt an das Programm +// zu gehen (das will die Maus nicht, oder ⇧ ist gedrückt). +func (w *window) localWheel(shift bool) bool { + return w.opts.attach && (w.term.MouseTracking() == termemu.MouseOff || shift) +} + +// scrollWheel: eine Raste Mausrad. +func (w *window) scrollWheel(up bool) { + if w.term.AltScreen() { + // less, man ohne Maus: Rad = Pfeiltasten + code := uv.KeyDown + if up { + code = uv.KeyUp + } + for i := 0; i < 3; i++ { + w.sendOrdered(encodeKey(uv.Key{Code: code})) + } + return + } + d := -3 + if up { + d = 3 + } + w.setScroll(w.scroll + d) +} + +// followScroll: Neue Ausgabe schiebt die Ansicht beim Lesen nicht weg. +func (w *window) followScroll() { + sb := w.term.ScrollbackLen() + if w.scroll > 0 && sb > w.sbSeen { + w.scroll = min(sb, w.scroll+sb-w.sbSeen) + } + if w.term.AltScreen() { + w.scroll = 0 + } + w.scroll = min(w.scroll, sb) + w.sbSeen = sb +} diff --git a/internal/gui/scroll_test.go b/internal/gui/scroll_test.go new file mode 100644 index 0000000..3a5c8d2 --- /dev/null +++ b/internal/gui/scroll_test.go @@ -0,0 +1,77 @@ +//go:build windows || darwin || linux + +package gui + +import ( + "bytes" + "fmt" + "io" + "strings" + "testing" + + uv "github.com/charmbracelet/ultraviolet" + + "github.com/db9979/sshtermy/internal/termemu" +) + +func rowText(cells []uv.Cell, w, y int) string { + var b strings.Builder + for _, c := range cells[y*w : (y+1)*w] { + b.WriteString(c.Content) + } + return strings.TrimSpace(b.String()) +} + +// Zweites Fenster (abgetrennter Tab): Mausrad und ⇧Bild↑ blättern im +// eigenen Verlauf, Tippen führt zurück nach unten. +func TestAttachWindowScrolls(t *testing.T) { + var sent bytes.Buffer + term := termemu.New(20, 5, io.Discard) + w := &window{opts: Options{attach: true}, term: term, in: &sent} + for i := 0; i < 50; i++ { + _, _ = term.Write([]byte(fmt.Sprintf("zeile %d\r\n", i))) + } + if !w.localWheel(false) { + t.Fatal("Rad muss im Fenster blättern, wenn das Programm die Maus nicht will") + } + w.scrollWheel(true) + if w.scroll != 3 { + t.Fatalf("Rad: scroll=%d", w.scroll) + } + if !w.scrollKey(uv.KeyPgUp, uv.ModShift) || w.scroll != 7 { + t.Fatalf("⇧Bild↑: scroll=%d", w.scroll) + } + if !w.scrollKey(uv.KeyHome, uv.ModShift) || w.scroll != term.ScrollbackLen() { + t.Fatalf("⇧Pos1: scroll=%d", w.scroll) + } + cells, cw, _ := term.SnapshotAt(nil, w.scroll) + if got := rowText(cells, cw, 0); got != "zeile 0" { + t.Fatalf("oberste Zeile im Rückblick: %q", got) + } + // neue Ausgabe verschiebt die Ansicht nicht + w.setScroll(10) + _, _ = term.Write([]byte("neu 1\r\nneu 2\r\n")) + w.followScroll() + if w.scroll != 12 { + t.Fatalf("Ansicht mitgewandert: scroll=%d", w.scroll) + } + if !w.scrollKey(uv.KeyEnd, uv.ModShift) || w.scroll != 0 { + t.Fatalf("⇧Ende: scroll=%d", w.scroll) + } + if w.scrollKey(uv.KeyPgUp, 0) { + t.Fatal("Bild↑ ohne ⇧ gehört dem Programm") + } + if sent.Len() != 0 { + t.Fatalf("Blättern darf nichts an den Server schicken: %q", sent.String()) + } + // Programm mit Maus (tmux, mc): Rad gehört ihm, ⇧ + Rad blättert + _, _ = term.Write([]byte("\x1b[?1000h")) + if w.localWheel(false) || !w.localWheel(true) { + t.Fatal("Maus-Programm: nur ⇧ + Rad blättert") + } + // Hauptfenster: dort blättert sshTermy selbst + main := &window{term: term, in: &sent} + if main.localWheel(true) || main.scrollKey(uv.KeyPgUp, uv.ModShift) { + t.Fatal("Hauptfenster darf nicht selbst blättern") + } +} diff --git a/internal/gui/window.go b/internal/gui/window.go index 7e44abf..932d523 100644 --- a/internal/gui/window.go +++ b/internal/gui/window.go @@ -223,6 +223,8 @@ type window struct { mouseY int mouseBtn uv.MouseButton wheelAcc float64 + scroll int // Zeilen Rückblick (nur zweites Fenster, scroll.go) + sbSeen int lastTitle string script *script @@ -448,6 +450,9 @@ func (w *window) keyboard() { continue } if code, ok := specialKeys[k]; ok { + if w.scrollKey(code, mod) { + continue + } buf = append(buf, encodeKey(uv.Key{Code: code, Mod: mod})...) continue } @@ -473,6 +478,9 @@ func (w *window) keyboard() { } } if len(buf) > 0 { + if w.scroll > 0 { + w.setScroll(0) // Tippen führt zurück nach unten + } w.sendOrdered(buf) } } @@ -544,6 +552,16 @@ func (w *window) mouse() { w.zoom(math.Copysign(1, wy)) return } + if wy != 0 && w.localWheel(ebiten.IsKeyPressed(ebiten.KeyShift)) { + w.wheelAcc += wy + for ; w.wheelAcc >= 1; w.wheelAcc-- { + w.scrollWheel(true) + } + for ; w.wheelAcc <= -1; w.wheelAcc++ { + w.scrollWheel(false) + } + return + } level := w.term.MouseTracking() if level == termemu.MouseOff { return @@ -609,9 +627,15 @@ func (w *window) Draw(screen *ebiten.Image) { screen.Fill(dBg) var cw, ch int - w.cells, cw, ch = w.term.Snapshot(w.cells) + if w.opts.attach { + w.followScroll() + } + w.cells, cw, ch = w.term.SnapshotAt(w.cells, w.scroll) pad := math.Round(padding * w.scale) curX, curY, curVis := w.term.Cursor() + if w.scroll > 0 { + curVis = false + } // erst alle Hintergründe, dann Schrift: breite Zeichen dürfen in die // Nachbarzelle ragen diff --git a/internal/termemu/mouse.go b/internal/termemu/mouse.go index 20ed451..4d53667 100644 --- a/internal/termemu/mouse.go +++ b/internal/termemu/mouse.go @@ -284,3 +284,24 @@ func (t *Term) LineText(line int) (text string, cols []int) { cols[w] = b.Len() return b.String(), cols } + +// SnapshotAt: wie Snapshot, aber offset Zeilen in den Verlauf zurück +// (0 = aktueller Bildschirm). Für das zweite eigene Fenster (gui), das +// selbst zurückblättert. +func (t *Term) SnapshotAt(dst []uv.Cell, offset int) ([]uv.Cell, int, int) { + sb := t.ScrollbackLen() + offset = max(0, min(offset, sb)) + if offset == 0 { + return t.Snapshot(dst) + } + w, h := t.Size() + if cap(dst) < w*h { + dst = make([]uv.Cell, w*h) + } + dst = dst[:w*h] + first := sb - offset + for y := 0; y < h; y++ { + t.lineCells(sb, first+y, uv.Line(dst[y*w:(y+1)*w])) + } + return dst, w, h +} diff --git a/internal/ui/detach.go b/internal/ui/detach.go index bd9d50d..3965cb4 100644 --- a/internal/ui/detach.go +++ b/internal/ui/detach.go @@ -220,6 +220,9 @@ func replayScreen(t *termemu.Term) string { b.WriteString("\x1b[?1049h") } b.WriteString("\x1b[0m\x1b[H\x1b[2J") + if !t.AltScreen() { + replayHistory(&b, t) + } lines := strings.Split(t.Render(0, nil), "\n") for i, l := range lines { if i > 0 { @@ -244,6 +247,21 @@ func replayScreen(t *termemu.Term) string { return b.String() } +// replayHistory: den Verlauf vor dem Bildschirm mitschicken, damit man im +// neuen Fenster auch weiter zurückblättern kann (Terminal oder eigenes +// Fenster sammeln ihn dort in ihrem eigenen Verlauf). +func replayHistory(b *strings.Builder, t *termemu.Term) { + sb := t.ScrollbackLen() + _, h := t.Size() + for off := sb; off > 0; off -= h { + lines := strings.Split(t.Render(off, nil), "\n") + for _, l := range lines[:min(h, off, len(lines))] { + b.WriteString(strings.TrimRight(l, " ")) + b.WriteString("\x1b[0m\r\n") + } + } +} + // detachedView: Platzhalter im Hauptfenster. func (a *App) detachedView(s *session, cols, rows int) string { st := a.s diff --git a/internal/ui/detach_test.go b/internal/ui/detach_test.go index 03e3c6e..db1639d 100644 --- a/internal/ui/detach_test.go +++ b/internal/ui/detach_test.go @@ -1,6 +1,7 @@ package ui import ( + "fmt" "io" "strings" "sync" @@ -104,3 +105,23 @@ func TestMuteReplies(t *testing.T) { t.Fatalf("ohne Stummschaltung muss der Emulator antworten: %q", g) } } + +// Der Verlauf geht mit ins eigene Fenster, damit man dort zurückblättern kann. +func TestReplayScreenHistory(t *testing.T) { + term := termemu.New(20, 4, io.Discard) + for i := 0; i < 30; i++ { + _, _ = term.Write([]byte(fmt.Sprintf("zeile %d\r\n", i))) + } + out := replayScreen(term) + if strings.Count(out, "zeile ") != 30 { + t.Fatalf("Verlauf fehlt oder doppelt: %d Zeilen", strings.Count(out, "zeile ")) + } + if strings.Index(out, "zeile 0\x1b") > strings.Index(out, "zeile 29") { + t.Fatal("Reihenfolge falsch") + } + // im Vollbild-Programm (vim, less) nur der Bildschirm + _, _ = term.Write([]byte("\x1b[?1049hvim")) + if out := replayScreen(term); strings.Contains(out, "zeile ") { + t.Fatal("Alt-Bildschirm: kein Verlauf") + } +} diff --git a/site/de/index.html b/site/de/index.html index 6e2687d..2c9b9d4 100644 --- a/site/de/index.html +++ b/site/de/index.html @@ -127,7 +127,7 @@ sudo apt update && sudo apt install sshtermy
Ordner, Tags, Jump-Hosts, Import aus ~/.ssh/config, PuTTY und MobaXterm.
Beenden fragt bei offenen Verbindungen nach, Löschen lässt sich 10 Sekunden lang rückgängig machen, Strg+T im Formular testet die Verbindung vor dem Speichern, und fehlgeschlagene Verbindungen erklären in Klartext, was los ist (mit Taste zum Beheben, z. B. neuen Host-Key nach Neuinstallation übernehmen). Der einfache Modus blendet Profi-Funktionen aus.
Kein Terminal nötig: Doppelklick auf die .exe, die .app öffnen oder sshtermy -window. Schrift, Nerd-Font-Symbole und Emoji sind eingebaut, jede Taste kommt an (Alt+⏎, ⇧F-Tasten, Strg+Leertaste), Bilder erscheinen pixelgenau, abgelegte Dateien werden hochgeladen, ⇧F10 öffnet ein zweites Fenster. Startet im Vollbild (F11 schaltet um; maximiert oder „wie zuletzt“ in den Einstellungen), Schriftgröße und Fensterposition werden gemerkt. Im Terminal gestartet läuft es wie bisher im Terminal.
Kein Terminal nötig: Doppelklick auf die .exe, die .app öffnen oder sshtermy -window. Schrift, Nerd-Font-Symbole und Emoji sind eingebaut, jede Taste kommt an (Alt+⏎, ⇧F-Tasten, Strg+Leertaste), Bilder erscheinen pixelgenau, abgelegte Dateien werden hochgeladen, ⇧F10 öffnet ein zweites Fenster, das den Verlauf mitnimmt und mit Mausrad oder ⇧+Bild↑ blättert. Startet im Vollbild (F11 schaltet um; maximiert oder „wie zuletzt“ in den Einstellungen), Schriftgröße und Fensterposition werden gemerkt. Im Terminal gestartet läuft es wie bisher im Terminal.
? gibt der KI mitten im Ziel eine Anweisung, ⇧S überspringt einen Schritt mit Grund. Fragt ein Befehl [Y/n] oder wartet ein Pager, zeigt das Panel Antwort-Knöpfe. Dateien, die ein Schritt ändert, werden vorher gesichert, u holt alle zurück; f startet ein Folgeziel, frühere Ziele stehen im Verlauf. Nach einem Verbindungsabbruch setzt ⏎ fort, und der Tab zeigt, wenn ein Ziel auf dich wartet.
Alt+Bild↑/Bild↓ springt im Verlauf von Befehl zu Befehl. Alt+O listet die Befehle des Tabs mit Uhrzeit, Dauer und Ergebnis: genau eine Ausgabe kopieren, an die KI geben oder groß lesen.
xterm-256color, Truecolor, vim, htop und tmux, Verlauf zum Zurückblättern (Mausrad oder ⇧+Bild↑), Tabs, geteilte Ansicht, Suche.
Folders, tags, jump hosts, import from ~/.ssh/config, PuTTY and MobaXterm.
Quitting asks while connections are open, deleting offers undo for 10 s, Ctrl+T in the form tests the connection before saving, and failed connections explain in plain language what's wrong (with a key to fix it, e.g. accept a new host key after a reinstall). Simple mode hides the pro features.
No terminal needed: double-click the .exe, open the .app or run sshtermy -window. Font, Nerd Font symbols and emoji are built in, every key arrives (Alt+⏎, ⇧F-keys, Ctrl+Space), images show pixel-perfect, dropped files are uploaded, ⇧F10 opens a second window. Starts in full screen (F11 toggles; maximized or “as last time” in the settings), font size and window position are remembered. From a terminal it runs in the terminal as before.
No terminal needed: double-click the .exe, open the .app or run sshtermy -window. Font, Nerd Font symbols and emoji are built in, every key arrives (Alt+⏎, ⇧F-keys, Ctrl+Space), images show pixel-perfect, dropped files are uploaded, ⇧F10 opens a second window that takes the scrollback along and scrolls with the mouse wheel or ⇧+PgUp. Starts in full screen (F11 toggles; maximized or “as last time” in the settings), font size and window position are remembered. From a terminal it runs in the terminal as before.
? gives the AI an instruction mid-goal, ⇧S skips a step with a reason. When a command asks [Y/n] or a pager waits, the panel shows answer buttons. Files a step changes are backed up first, u restores them all; f starts a follow-up goal, earlier goals are in the history. After a connection drop ⏎ continues, and the tab shows when a goal is waiting for you.
Alt+PgUp/PgDn jumps from command to command in the scrollback. Alt+O lists the tab's commands with time, duration and result: copy exactly one output, hand it to the AI or read it in full.
xterm-256color, truecolor, vim, htop and tmux, scrollback (mouse wheel or ⇧+PgUp), tabs, split view, search.