Skip to content

feat(composer): allow switching Enter vs Shift+Enter to send - #1022

Merged
XingYu-Zhong merged 1 commit into
KunAgent:developfrom
musnows:codex/composer-send-key
Jul 25, 2026
Merged

feat(composer): allow switching Enter vs Shift+Enter to send#1022
XingYu-Zhong merged 1 commit into
KunAgent:developfrom
musnows:codex/composer-send-key

Conversation

@musnows

@musnows musnows commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a persisted composerSendKey setting (enter | shiftEnter) so users can choose whether Enter or Shift+Enter sends from the chat composer.
  • Wire FloatingComposer hotkey handling and Settings → Basics UI to the new preference; the other key inserts a newline.
  • Keep @ mention commit on Enter when the mention menu is open, and include the setting in settings migrate/export paths.

Changes

  • Shared settings: type, normalize, domain ownership, IPC patch schema, defaults
  • Renderer: settings control + i18n, live setting hook, composer keydown
  • Tests/fixtures updated for the new required settings field

Tests

  • npx vitest run src/shared/app-settings.test.ts src/shared/app-settings-domain.test.ts src/renderer/src/locales/locale-resources.test.ts src/renderer/src/components/settings-section-general.test.ts
  • npm run typecheck
  • Manual: Settings → Basics → switch send shortcut, verify Enter / Shift+Enter behavior in composer

Made with Cursor

Add a persisted composerSendKey setting so users can choose whether Enter
or Shift+Enter sends from the chat composer, with the other key inserting
a newline.

Co-authored-by: Cursor <cursoragent@cursor.com>
@XingYu-Zhong
XingYu-Zhong force-pushed the codex/composer-send-key branch from d1f3147 to ce65540 Compare July 25, 2026 14:29
@XingYu-Zhong

Copy link
Copy Markdown
Collaborator

Rebase + review

已把本 PR rebase 到最新 develop,并 force-push 到 musnows:codex/composer-send-key

  • 丢掉已合入的 electron-updater bump(develop / v0.2.31 已包含)
  • 解决 app-settings-domain.tsinitialSetupCompleted 的冲突
  • 补了一处行为缺口:底部 footer 快捷键提示会随 composerSendKey 切换(新增 composerShortcutShiftEnter

审查结论:建议合入(功能有价值,实现也基本到位)

做得好的地方

  • 设置贯通完整:AppSettingsV1 → normalize → IPC zod → settings store default → 导出/迁移 → Settings UI → FloatingComposer
  • 默认仍是 enter,兼容现有习惯
  • isComposerSendHotkey 排除了 meta/ctrl,避免和系统快捷键打架
  • hook 监听 SETTINGS_CHANGED_EVENT,改设置后无需重启
  • 多语言文案齐全

本地已验证

  • vitestapp-settings / app-settings-domain / locale-resources / settings-section-general(128 passed)
  • npm run typecheck 通过

残留小问题(不阻塞合入,可后续跟)

  • placeholder / composerHint 等文案仍写死 “Shift+Enter 换行”,切到 shiftEnter 发送后文案可能略不一致;footer 提示已修好
  • @ 文件提及仍用裸 Enter 确认(合理,且在 shiftEnter 发送模式下不会误发送)

CI 跑绿后即可合。

@XingYu-Zhong XingYu-Zhong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after rebase onto develop.

Verified locally: focused vitest (128) + typecheck. Default remains Enter-to-send; setting is persisted and applied live. Footer shortcut hint now follows the selected send key.

Residual non-blocking: some placeholders still hardcode Shift+Enter-for-newline copy.

@XingYu-Zhong
XingYu-Zhong merged commit 9a2e5ea into KunAgent:develop Jul 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants