diff --git a/pty_session.go b/pty_session.go index 78022a0..fc4c515 100644 --- a/pty_session.go +++ b/pty_session.go @@ -1,6 +1,7 @@ package main import ( + "bytes" "fmt" "log" "os" @@ -11,6 +12,10 @@ import ( "github.com/creack/pty" ) +// ANSI escape sequence to hide cursor — Claude Code's Ink TUI sends this. +// We strip it so xterm.js cursor stays visible. +var cursorHideSeq = []byte("\x1b[?25l") + const ( outputBufferSize = 128 * 1024 // 128KB ring buffer for replay ptyIdleTimeout = 60 * time.Minute @@ -118,6 +123,12 @@ func (s *PTYSession) readLoop() { data := make([]byte, n) copy(data, buf[:n]) + // Strip cursor hide sequence so xterm.js cursor stays visible + data = bytes.ReplaceAll(data, cursorHideSeq, []byte{}) + if len(data) == 0 { + continue + } + s.buffer.Write(data) s.mu.Lock()