提供「Enter 发送 / Ctrl+Enter 发送」可配置的聊天发送快捷键开关
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
**提交人**: 匿名
**客户端版本**: 0.1.25
---
## 使用场景
在聊天输入框里写长消息、贴代码、或用中文输入法选词时,目前按 `Enter` 会**直接发送**消息(该行为是硬编码的)。这很容易在还没写完、只是想换行时误触发送,把半成品消息发出去。
当前硬编码逻辑:
- `Enter` → 发送(queue)
- `Shift+Enter` / `Alt+Enter` → 插入换行
- `Ctrl/Cmd+Enter` → 触发 steer(引导/微调),并不是发送
很多聊天/编辑器工具(Slack、Discord、VS Code Chat、各类 AI 客户端)都把 `Ctrl+Enter` 作为发送、`Enter` 作为换行,或至少允许用户选择。
## 诉求
在设置里提供一个「发送快捷键」可选项,让用户在两种模式间切换:
- 模式 A(默认,保持现状):`Enter` 发送,`Shift+Enter` 换行
- 模式 B:`Ctrl/Cmd+Enter` 发送,`Enter` 换行
默认保持 A,不破坏现有用户习惯。
## 建议方案
1. 在 Settings(设置)→ Chat / General 增加一个发送快捷键开关;
2. 把目前写死在 CodeMirror composer `handleKeyDown` 里的 Enter/steer 判断改为读取该设置;
3. 备选:也可只在输入框右键菜单加一个切换项,比放设置里更轻量;或做成每会话可切换而非全局。
我在当前版本 `app.asar` 里确认过,目前没有任何持久化设置控制这个行为,需要改代码加设置项,仅改配置文件无法实现。
---
**版本区域**: CN
**OS**: win32 x64 (10.0.26200)
**界面语言**: zh-CN
Contributor guide
Research direction
Start at the CodeMirror composer handleKeyDown logic and trace the existing Settings persistence and Chat/General UI. Implement the two selectable modes while preserving the default behavior, then verify Enter, Shift/Alt+Enter, and Ctrl/Cmd+Enter in both modes and confirm the choice persists.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- desktop, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100