feat: enhance message input with system tag parsing and double-click navigation#76
feat: enhance message input with system tag parsing and double-click navigation#76heiboy0070 wants to merge 9 commits intowxtsky:mainfrom
Conversation
wxtsky
left a comment
There was a problem hiding this comment.
感谢这个功能!消息输入和 TerminalWriter 的覆盖面很全面。Review 后发现几个需要修复的问题:
🚫 Blocker: 中文输入法(IME)不兼容
复现步骤:
- 使用中文输入法在 MessageInputBar 输入中文(如输入 "哦哦哦")
- 按 Enter 发送
预期:发送 "哦哦哦" 到终端
实际:输入框内容变为原始键盘输入(如 "aaa"),消息未发送
原因:SwiftUI TextField 的 .onSubmit 与 macOS 输入法的 Enter 键冲突。IME 先捕获 Enter 键处理 composition,导致 .onSubmit 拿到的是 raw input 而非已转换的中文。
建议修复方向:
- 使用
NSViewRepresentable包装NSTextField,在textView(_:doCommandBy:)中检查hasMarkedText,仅在无活跃 composition 时处理 Enter - 或者:移除
.onSubmit,改用onKeyPress(.return)(macOS 14+),它在 IME commit 之后才触发
其他建议
-
UX 变更需谨慎:Session 卡片点击从「跳转终端」改为「打开消息输入」,这是一个影响所有用户习惯的变更。建议保持原有点击行为(跳转终端),仅通过 💬 按钮进入消息输入
-
Magic delay:
approvePermission中asyncAfter(deadline: .now() + 0.5)硬编码延迟不可靠,建议用 completion handler -
L10n:新增的 4 个 key(
send_message_placeholder等)缺少日韩翻译,会与 PR #72 冲突 -
编译 warning:3 处
?? "..."nil coalescing 多余(L10n subscript 返回非 optional),可以移除
wxtsky
left a comment
There was a problem hiding this comment.
感谢这个功能!消息输入和 TerminalWriter 的覆盖面很全面。Review 后发现几个需要修复的问题:
Blocker: 中文输入法(IME)不兼容
复现步骤:
- 使用中文输入法在 MessageInputBar 输入中文(如输入 "哦哦哦")
- 按 Enter 发送
预期:发送 "哦哦哦" 到终端
实际:输入框内容变为原始键盘输入(如 "aaa"),消息未发送
原因:SwiftUI TextField 的 .onSubmit 与 macOS 输入法的 Enter 键冲突。IME 先捕获 Enter 键处理 composition,导致 .onSubmit 拿到的是 raw input 而非已转换的中文。
建议修复方向:
- 使用 NSViewRepresentable 包装 NSTextField,在 textView(_:doCommandBy:) 中检查 hasMarkedText,仅在无活跃 composition 时处理 Enter
- 或者:移除 .onSubmit,改用 onKeyPress(.return)(macOS 14+),它在 IME commit 之后才触发
其他建议
-
UX 变更需谨慎:Session 卡片点击从「跳转终端」改为「打开消息输入」,这是一个影响所有用户习惯的变更。建议保持原有点击行为(跳转终端),仅通过消息按钮进入消息输入
-
Magic delay:approvePermission 中 asyncAfter(deadline: .now() + 0.5) 硬编码延迟不可靠,建议用 completion handler
-
L10n:新增的 4 个 key(send_message_placeholder 等)缺少日韩翻译,会与 PR #72 冲突
-
编译 warning:3 处 ?? nil coalescing 多余(L10n subscript 返回非 optional),可以移除
wxtsky
left a comment
There was a problem hiding this comment.
Review: IME bug + suggestions
Blocker: Chinese IME incompatibility
Steps: Type Chinese (e.g. 哦哦哦) in MessageInputBar, press Enter.
Expected: Send Chinese text to terminal.
Actual: Input becomes raw keystrokes (e.g. aaa), message not sent.
Root cause: SwiftUI TextField onSubmit conflicts with macOS IME Enter key handling. IME captures Enter for composition, so onSubmit receives raw input instead of converted Chinese.
Fix suggestion: Use NSViewRepresentable wrapping NSTextField, check hasMarkedText in textView doCommandBy, only handle Enter when no active composition. Or use onKeyPress(.return) on macOS 14+ which fires after IME commit.
Other suggestions
- UX: Session card click changed from jump-to-terminal to open-message-input. This breaks existing user habits. Suggest keeping original click behavior, use message button only.
- Magic delay: asyncAfter 0.5s in approvePermission is fragile. Use completion handler instead.
- L10n: 4 new keys missing ja/ko translations, will conflict with PR 72.
- Warnings: 3 unnecessary nil coalescing operators (L10n subscript is non-optional).
|
Hi, thanks for the latest commit (Markdown renderer)! However, the previous review issues are still unresolved:
Please address these before the next review round. The IME blocker is the highest priority. Thanks! |
0d904ac to
d2b7b41
Compare
- Add IslandSurface.messageInput state for message input UI - Create TerminalWriter module to send text to various terminals - Add MessageInputBar with session context preview - Integrate message input into notch panel and session cards - Support content attachment in permission approval flow - Add L10n support for new features
…ll UI - Add TerminalWriter.sendText() for sending text to various terminals - Add MessageInputBar with session context preview and markdown rendering - Parse system tags (task-notification, system-reminder) to show structured info - Improve approval bar with inline input for attaching content to decisions - Add Apple-style scroll view wrapper following DESIGN.md guidelines Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add TapGesture(count: 2) to the notch bar area - Use contentShape(Rectangle()) to make entire bar clickable - Animate transition back to .sessionList with NotchAnimation.close Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix Chinese IME compatibility using NSTextField with hasMarkedText check - Restore session card click behavior to activate terminal (UX fix) - Add global ESC key handler using NSEvent monitor - Add input text persistence across session navigation - Improve table rendering with inline markdown support - Remove redundant nil coalescing operators
d2b7b41 to
1dd1239
Compare
Add a new setting in Behavior section to choose what happens when clicking a session card: - Activate Terminal (default) - Open Message Input This allows users who prefer the message input panel to set it as the default click action. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add timestamp-based debouncing to prevent duplicate sends - Fix memory leak in ESC key monitor (add cleanup onDisappear) - Add clipboard-based fallback for terminal text sending - Add error status display on session cards (5 min window) - Add horizontal scroll for wide markdown tables
问题:当通过消息输入框发送消息时,消息会被发送两次 根因:AppleScript 脚本在找到目标 session 后没有立即 return, 导致继续执行循环并返回 "not_found",然后降级到 sendViaITermCurrentSession,向错误的 session 再次发送。 修复:在 AppleScript 脚本中找到 session 后立即 return "found", 不再降级到错误的 session。
- PR wxtsky#80 MERGED: configurable notch height modes → T-026 - PR wxtsky#86 open: auto-collapse after session jump → T-027 (watch) - PR wxtsky#76 open: message input bar + TerminalWriter → T-028 (watch) - Issue wxtsky#84: Ghostty quick terminal activation bug → T-029 - Note PR wxtsky#69 and wxtsky#70 now merged upstream (T-024, T-025 ready) - vibe-island: no new code changes https://claude.ai/code/session_01Hoa4hooNsWEnv8vC42x8G3
wxtsky
left a comment
There was a problem hiding this comment.
感谢持续迭代!IME 兼容和 Session 点击行为配置化都改好了 👍 还有几个问题需要修复:
仍需修复
1. Magic delay 0.5s 仍然存在(上次 review 已提)
AppState.swift 中 approvePermission 和 denyPermission 里的 DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) 还在。硬编码延迟不可靠——网络慢时 0.5s 不够,快时白等。建议用 completion handler 或在权限 response resume 之后再发送。
2. ApprovalBar 输入框未使用 IME 兼容方案
MessageInputBar 已经用了 IMECompatibleTextField(NSTextField 包装),但 ApprovalBar 里新增的附加内容输入框还是用的原生 SwiftUI TextField + .onSubmit——中文输入法 Enter 键冲突问题同样会出现。请统一使用 IMECompatibleTextField。
3. L10n 新增 key 缺少土耳其语翻译
新增的 send_to_terminal、approval_input_placeholder、session_click_action、session_click_action_desc、click_action_terminal、click_action_message_input、remote_input_unsupported 等 key 在土耳其语中只补了部分。请补齐,或者至少让 L10n fallback 到英文不会 crash(确认现有 fallback 机制能覆盖)。
4. ESC 键监听可能重复安装
installEscapeKeyMonitor() 在 onAppear 调用,但如果 view 重建(比如外部显示器切换),会重复安装而旧的 monitor 没被清理。建议在安装前先检查 escapeMonitor != nil 则先清理旧的。
已修复 ✅
- IME 兼容性 →
IMECompatibleTextField+hasMarkedText检查 - Session 卡片点击行为 → 可配置(默认 terminal)
- iTerm2 消息重复发送 → AppleScript return 修复
- 防重复发送 → timestamp debounce
|
Hi @heiboy0070, 这个 PR 已经好几轮 review 了。关键的 blocker 还差几个:
另外建议把 PR 拆成几块(TerminalWriter 基建 / MessageInputBar / ApprovalBar 附加内容 / 系统标签解析 / 双击刘海),方便 review 和回滚。1400+ 行的 PR 合进去风险太大。 最近两周如果没动静,我会先 close 掉。非常感谢你的工作,希望能把这几个问题收一下 💪 |
…retired) - T-034: ConfigInstaller destructive reformat bug confirmed (issue wxtsky#106) - T-035: Multi-Space agent visibility issue to investigate (issue wxtsky#104) - T-028: PR wxtsky#76 closed/abandoned upstream — retired from kanban https://claude.ai/code/session_0144Meziev1pfqVGh547wmvG
概述
增强刘海面板的消息输入功能,支持直接向 AI 终端发送消息,并优化用户交互体验。
主要变更
1. 消息输入功能
MessageInputBar组件,在刘海面板中直接输入消息TerminalWriter模块,支持多种终端(iTerm2、tmux、WezTerm、kitty 等)2. 权限批准附加内容
TerminalWriter发送到终端3. 系统标签解析
4. 交互优化
技术细节
NSRegularExpression处理多行 XML 标签DispatchQueue.main.asyncAfter延迟发送内容,确保权限已处理ChatMessageTextFormatter复用项目现有的 Markdown 渲染测试
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com