Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/shift-enter-csi-u.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---

fix(tui): treat CSI-u Shift+Enter as an editor newline
1 change: 1 addition & 0 deletions apps/kimi-code/src/tui/components/editor/custom-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ function stripSgr(s: string): string {

function getNewlineInput(data: string): string | undefined {
if (data === '\n' || data === '\u001B\r' || data === '\u001B[13;2~') return data;
if (data === '\u001B[13;2u') return '\n';
if (matchesKey(data, Key.ctrl('j'))) return '\n';
return undefined;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,18 @@ describe('CustomEditor paste marker expansion', () => {
});

describe('CustomEditor shortcut telemetry hooks', () => {
it('reports newline shortcuts, including Ctrl-J, before delegating to the base editor', () => {
it('reports newline shortcuts, including Ctrl-J and CSI-u Shift+Enter, before delegating to the base editor', () => {
const editor = makeEditor();
const onInsertNewline = vi.fn();
editor.onInsertNewline = onInsertNewline;

editor.handleInput('a');
editor.handleInput('\n');
editor.handleInput('\u001B[106;5u');
editor.handleInput('\u001B[13;2u');

expect(onInsertNewline).toHaveBeenCalledTimes(2);
expect(editor.getText()).toBe('a\n\n');
expect(onInsertNewline).toHaveBeenCalledTimes(3);
expect(editor.getText()).toBe('a\n\n\n');
});

it('reports undo shortcuts before delegating to the base editor', () => {
Expand Down