Skip to content
Merged
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/task-output-ctrl-ud-paging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---

Add Ctrl+U and Ctrl+D as page up and page down shortcuts in the task output viewer.
15 changes: 12 additions & 3 deletions apps/kimi-code/src/tui/components/dialogs/task-output-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,20 @@ export class TaskOutputViewer extends Container implements Focusable {
this.scrollBy(1);
return;
}
if (matchesKey(data, Key.pageUp) || k === ' ' || data === '\u0002' /* C-b */) {
if (
matchesKey(data, Key.pageUp) ||
matchesKey(data, Key.ctrl('u')) ||
k === ' ' ||
data === '\u0002' /* C-b */
) {
this.scrollBy(-Math.max(1, visible - 1));
return;
}
if (matchesKey(data, Key.pageDown) || data === '\u0006' /* C-f */) {
if (
matchesKey(data, Key.pageDown) ||
matchesKey(data, Key.ctrl('d')) ||
data === '\u0006' /* C-f */
) {
this.scrollBy(Math.max(1, visible - 1));
return;
}
Expand Down Expand Up @@ -240,7 +249,7 @@ export class TaskOutputViewer extends Container implements Focusable {
);
const keys =
`${key('↑↓')} ${dim('line')} ` +
`${key('PgUp/PgDn')} ${dim('page')} ` +
`${key('PgUp/PgDn/Ctrl+U/D')} ${dim('page')} ` +
`${key('g/G')} ${dim('top/bot')} ` +
`${key('Q/Esc')} ${dim('cancel')}`;
const left = ` ${keys}`;
Expand Down
18 changes: 18 additions & 0 deletions apps/kimi-code/test/tui/task-output-viewer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,24 @@ describe('TaskOutputViewer — scrolling', () => {
expect(out).not.toContain('line-001');
});

it('Ctrl+D scrolls a page down', () => {
const viewer = makeViewer({ output: bigOutput(50), rows: 12 });
viewer.handleInput('\u0004'); // Ctrl+D
const out = strip(viewer.render(120).join('\n'));
// Same page size as PageDown: body has 8 viewable rows, page = 7 lines.
expect(out).toContain('line-008');
expect(out).not.toContain('line-001');
});

it('Ctrl+U scrolls a page up', () => {
const viewer = makeViewer({ output: bigOutput(50), rows: 12 });
viewer.handleInput('G'); // jump to bottom first
viewer.handleInput('\u0015'); // Ctrl+U
const out = strip(viewer.render(120).join('\n'));
expect(out).toContain('line-036');
expect(out).not.toContain('line-050');
});

it('G jumps to the bottom', () => {
const viewer = makeViewer({ output: bigOutput(100), rows: 14 });
viewer.handleInput('G');
Expand Down
Loading