Skip to content

Commit c819374

Browse files
committed
feat(ui): 添加无服务器时按Esc键退出的功能
- 在McpStatusList组件中监听键盘输入事件 - 当服务器列表为空时,按Esc键或Ctrl+C触发退出操作 - 确保用户可通过快捷键安全退出无服务器状态界面
1 parent bee349b commit c819374

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/ui/McpStatusList.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ export function McpStatusList({ statuses, onCancel }: Props): React.ReactElement
2828
}
2929
}, [statuses, selectedServerIndex]);
3030

31+
// 当没有服务器时,监听 Esc 键退出
32+
useInput((input, key) => {
33+
if (statuses.length === 0 && (key.escape || (key.ctrl && (input === "c" || input === "C")))) {
34+
onCancel();
35+
}
36+
});
37+
3138
if (statuses.length === 0) {
3239
return (
3340
<Box flexDirection="column" marginLeft={1} paddingX={1} gap={1} borderStyle="round" borderDimColor>

0 commit comments

Comments
 (0)