返回 DeepSeek-Reasonix
sync_output.go
根目录 / internal / cli / sync_output.go
1 package cli
2
3 import (
4 "os"
5 "strings"
6
7 tea "charm.land/bubbletea/v2"
8 "github.com/charmbracelet/x/ansi"
9 )
10
11 // forceSyncOutputCmd turns on the renderer's synchronized-output (DEC mode
12 // 2026) wrapping for SSH sessions. bubbletea skips its capability query over
13 // SSH because DECRPM replies are unreliable through some gateways, which
14 // leaves every repaint unsynchronized across the extra transport hop and
15 // reads as flicker while typing (local Windows Terminal into a remote pwsh7,
16 // #8405). Reporting the mode the way a supporting terminal would flips the
17 // renderer on; terminals without 2026 ignore the per-frame sequences by spec.
18 // REASONIX_DISABLE_SYNC_OUTPUT=1 opts out.
19 func forceSyncOutputCmd() tea.Cmd {
20 if !remoteClipboardSession() {
21 return nil
22 }
23 if v := strings.TrimSpace(os.Getenv("REASONIX_DISABLE_SYNC_OUTPUT")); v != "" && v != "0" {
24 return nil
25 }
26 return func() tea.Msg {
27 return tea.ModeReportMsg{Mode: ansi.ModeSynchronizedOutput, Value: ansi.ModeReset}
28 }
29 }
30
30 lines GO