Files
Claude c309401162 Configuration: the sysop is never timed out of it
The sysop's configuration screens (the sysop menu's F, on a text
terminal or a 3270, and bbs config on the console) ended at the idle
timeout like any caller's screen. Editor.Run now holds the idle timeout
off for as long as it runs (view.Unhurried, from the text and 3270
front ends); the login's hard limit and a hangup still end it. A Term
with Idle 0 waits without a limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTXXCusbxh6h6Btenm
2026-11-10 13:13:57 +00:00

43 lines
873 B
Go

package textui
import (
"errors"
"net"
"testing"
"time"
)
// TestHoldIdle: the sysop's configuration waits past the idle timeout
// for a key; the timeout is back after it
func TestHoldIdle(t *testing.T) {
a, b := net.Pipe()
defer a.Close()
defer b.Close()
go func() {
buf := make([]byte, 64)
for {
if _, err := b.Read(buf); err != nil {
return
}
}
}()
term := NewTerm(a)
term.Idle = 20 * time.Millisecond
s := &session{t: term}
restore := s.HoldIdle()
go func() {
time.Sleep(100 * time.Millisecond)
b.Write([]byte("x"))
}()
if k, err := term.EditKey(); err != nil || k != 'x' {
t.Fatalf("held: %q, %v; want 'x'", k, err)
}
restore()
if term.Idle != 20*time.Millisecond {
t.Fatalf("Idle %v after restore", term.Idle)
}
if _, err := term.EditKey(); !errors.Is(err, ErrIdle) {
t.Fatalf("restored: %v, want ErrIdle", err)
}
}