From 1b53357dedb00f14f7d1bafacbd39881b880ab4b Mon Sep 17 00:00:00 2001 From: abel533 Date: Sat, 4 Apr 2026 17:38:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Ctrl+C=20=E4=B8=AD=E6=96=AD=20Agent=20?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=EF=BC=88=E8=80=8C=E9=9D=9E=E9=80=80=E5=87=BA?= =?UTF-8?q?=E5=BA=94=E7=94=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用 Ink.render(component, false) 禁用默认 Ctrl+C 退出 - Ctrl+C 在 Agent 运行中触发 cancel(),停止当前循环 - Ctrl+C 在空闲时清空输入 - 保留 Ctrl+D 作为退出快捷键 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/main/java/com/claudecode/tui/JinkReplSession.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/claudecode/tui/JinkReplSession.java b/src/main/java/com/claudecode/tui/JinkReplSession.java index 649a248..9309af0 100644 --- a/src/main/java/com/claudecode/tui/JinkReplSession.java +++ b/src/main/java/com/claudecode/tui/JinkReplSession.java @@ -93,8 +93,8 @@ public class JinkReplSession { conversationSummary = text.length() > 40 ? text.substring(0, 40) : text; }); - // 启动 jink 渲染 - inkApp = Ink.render(component); + // 启动 jink 渲染(exitOnCtrlC=false,让组件处理 Ctrl+C) + inkApp = Ink.render(component, false); // 拦截 System.out/err,防止日志干扰 TUI inkApp.patchConsole();