返回 DeepSeek-Reasonix
mouse_default_test.go
根目录 / internal / cli / mouse_default_test.go
1 package cli
2
3 import "testing"
4
5 // TestMouseCaptureDefaultsOffOverSSH pins the #8345 behavior: mouse capture
6 // (which blocks the terminal's native selection over SSH) starts off in a
7 // remote session unless the user forces it back on.
8 func TestMouseCaptureDefaultsOffOverSSH(t *testing.T) {
9 for _, k := range []string{"SSH_CONNECTION", "SSH_CLIENT", "SSH_TTY", "REASONIX_DISABLE_MOUSE"} {
10 t.Setenv(k, "")
11 }
12 if mouseCaptureOffByDefault() {
13 t.Fatal("local sessions keep in-app mouse capture on by default")
14 }
15 t.Setenv("SSH_TTY", "/dev/pts/3")
16 if !mouseCaptureOffByDefault() {
17 t.Fatal("SSH sessions must start with native mouse (capture off)")
18 }
19 t.Setenv("REASONIX_DISABLE_MOUSE", "0")
20 if mouseCaptureOffByDefault() {
21 t.Fatal("REASONIX_DISABLE_MOUSE=0 must force capture on even over SSH")
22 }
23 t.Setenv("REASONIX_DISABLE_MOUSE", "1")
24 t.Setenv("SSH_TTY", "")
25 if !mouseCaptureOffByDefault() {
26 t.Fatal("REASONIX_DISABLE_MOUSE=1 keeps capture off locally")
27 }
28 }
29
29 lines GO