@@ -131,40 +131,19 @@ func replHooks() iteragent.AgentHooks {
131131 }
132132}
133133
134- // ctrlCExitCh is closed when the user presses Ctrl+C while idle (no active request).
135- // The REPL loop listens on this channel to exit cleanly.
136- var ctrlCExitCh = make (chan struct {}, 1 )
137-
138134// initREPL loads config, applies theme, sets up signal handling and runtime state.
139135func setupSigintHandler () {
140136 sigCh := make (chan os.Signal , 1 )
141137 signal .Notify (sigCh , syscall .SIGINT )
142138 go func () {
143- var lastIdle time.Time
144139 for range sigCh {
145140 if sess .RequestCancel != nil {
146- // Active request — cancel it.
147141 sess .RequestCancel ()
142+ // Snapshot colors under read lock — applyTheme writes these from the main goroutine.
148143 colorMu .RLock ()
149144 y , r := colorYellow , colorReset
150145 colorMu .RUnlock ()
151146 fmt .Printf ("\r \033 [K%s[cancelled]%s\n " , y , r )
152- lastIdle = time.Time {} // reset idle timer after cancel
153- } else {
154- // Idle — double-Ctrl+C to exit.
155- now := time .Now ()
156- if ! lastIdle .IsZero () && now .Sub (lastIdle ) < 2 * time .Second {
157- select {
158- case ctrlCExitCh <- struct {}{}:
159- default :
160- }
161- } else {
162- lastIdle = now
163- colorMu .RLock ()
164- d , r := colorDim , colorReset
165- colorMu .RUnlock ()
166- fmt .Printf ("\r \033 [K%s(press Ctrl+C again to exit)%s\n " , d , r )
167- }
168147 }
169148 }
170149 }()
@@ -242,20 +221,8 @@ func runREPL(ctx context.Context, p iteragent.Provider, repoPath string, thinkin
242221 }
243222
244223 for {
245- // Check for double-Ctrl+C exit signal before blocking on ReadInput.
246- select {
247- case <- ctrlCExitCh :
248- return
249- default :
250- }
251-
252224 line , ok := selector .ReadInput ()
253225 if ! ok {
254- // Check if this was a double-Ctrl+C exit.
255- select {
256- case <- ctrlCExitCh :
257- default :
258- }
259226 break
260227 }
261228 if line == "" {
0 commit comments