fix(kimi-code): reduce /btw panel max height to one-third of terminal (#802)

This commit is contained in:
liruifengv 2026-06-16 11:12:20 +08:00 committed by GitHub
parent c48e823f61
commit aa1896ca74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View file

@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---
Reduce the maximum height of the /btw side panel from half to one-third of the terminal.

View file

@ -185,7 +185,7 @@ export class BtwPanelComponent implements Component {
private collapsedBodyLimit(): number | undefined {
const terminalRows = this.options.terminalRows();
if (!Number.isFinite(terminalRows) || terminalRows <= 0) return undefined;
const maxPanelLines = Math.max(MIN_COLLAPSED_PANEL_LINES, Math.floor(terminalRows / 2));
const maxPanelLines = Math.max(MIN_COLLAPSED_PANEL_LINES, Math.floor(terminalRows / 3));
return Math.max(1, maxPanelLines - 1);
}

View file

@ -1762,10 +1762,10 @@ command = "vim"
expect(finalLines.at(-1)).toMatch(/^│\s+│$/);
});
it('caps /btw height to half the terminal and supports scrolling', async () => {
it('caps /btw height to one-third of the terminal and supports scrolling', async () => {
const session = makeSession();
const { driver } = await makeDriver(session);
setTerminalRows(driver, 12);
setTerminalRows(driver, 15);
await openBtwPanel(driver, session, 'question 1');
const panel = getMountedBtwPanel(driver);
@ -1778,7 +1778,7 @@ command = "vim"
}
const collapsed = panel.render(80).map(stripSgr);
expect(collapsed).toHaveLength(6);
expect(collapsed).toHaveLength(5);
expect(collapsed.join('\n')).toContain('BTW ─ Esc close · ↑↓ scroll');
expect(collapsed.join('\n')).not.toContain('ctrl+o expand');
expect(collapsed.join('\n')).toContain('question 8');