Skip to content

fix(tui): recognize CSI-u Shift+Enter as newline#272

Open
haosenwang1018 wants to merge 1 commit into
MoonshotAI:mainfrom
haosenwang1018:fix/shift-enter-csi-u-newline
Open

fix(tui): recognize CSI-u Shift+Enter as newline#272
haosenwang1018 wants to merge 1 commit into
MoonshotAI:mainfrom
haosenwang1018:fix/shift-enter-csi-u-newline

Conversation

@haosenwang1018
Copy link
Copy Markdown

@haosenwang1018 haosenwang1018 commented Jun 1, 2026

Related Issue

Resolve #256

Problem

Windows Terminal and some other terminals can encode Shift+Enter as the CSI-u sequence ESC [ 13 ; 2 u. CustomEditor already handled LF, ESC + CR, ESC [ 13 ; 2 ~, and Ctrl-J as newline shortcuts, but did not recognize this CSI-u variant, so the sequence fell through to the base editor instead of inserting a newline.

What changed

  • Treat the CSI-u Shift+Enter sequence as a newline input in CustomEditor.
  • Keep the existing newline sequences unchanged.
  • Extend the existing custom editor shortcut test to assert that CSI-u Shift+Enter fires the newline telemetry hook and inserts a newline.
  • Add a patch changeset for @moonshot-ai/kimi-code.

Verification

  • pnpm --filter @moonshot-ai/kimi-code run test — 111 files / 1015 tests passed / 2 skipped.
  • pnpm --filter @moonshot-ai/kimi-code exec vitest run test/tui/components/editor/custom-editor.test.ts
  • pnpm --filter @moonshot-ai/kimi-code run typecheck
  • pnpm changeset status --since=origin/main
  • pnpm exec oxlint apps/kimi-code/src/tui/components/editor/custom-editor.ts apps/kimi-code/test/tui/components/editor/custom-editor.test.ts — 0 errors; existing escape-sequence warnings remain in unchanged paste-marker test lines.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 1, 2026

🦋 Changeset detected

Latest commit: 3622cc4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

Shift+Enter无法正确换行

1 participant