Skip to content

Commit bbf65a7

Browse files
committed
fix(inquirerer): let input area grow freely like Claude Code
- Remove 5-line limit on input area - Input area grows as user adds newlines, conversation area shrinks - Simpler approach matching Claude Code's behavior
1 parent 30bf119 commit bbf65a7

1 file changed

Lines changed: 14 additions & 44 deletions

File tree

packages/inquirerer/src/ui/aicode.ts

Lines changed: 14 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -756,10 +756,9 @@ export class AICodeUI {
756756
lines.push(...conversationLines);
757757
}
758758

759-
// Fill remaining space (use fixed max input height for stable layout)
760-
// Max input area: 5 lines (or fewer if buffer is smaller)
761-
const maxVisibleInputLines = Math.min(5, this.lineEditor.lines.length);
762-
const reservedLines = 3 + maxVisibleInputLines; // separator + input lines + status
759+
// Fill remaining space - input area grows freely, conversation shrinks
760+
const inputLineCount = this.lineEditor.lines.length;
761+
const reservedLines = 3 + inputLineCount; // separator + input lines + status
763762
while (lines.length < this.viewportHeight - reservedLines) {
764763
lines.push('');
765764
}
@@ -919,41 +918,15 @@ export class AICodeUI {
919918
}
920919

921920
/**
922-
* Render the input lines (supports multiline with scrolling)
923-
* Uses a fixed max height (5 lines) to keep layout stable
921+
* Render the input lines (all lines shown, area grows freely)
924922
*/
925923
private renderInputLines(width: number): string[] {
926924
const lines: string[] = [];
927925
const inputText = this.getInput();
928926
const hasContent = inputText.length > 0;
929-
const totalLines = this.lineEditor.lines.length;
930-
931-
// Fixed max visible input lines (must match layout calculation in render())
932-
const maxInputLines = 5;
933-
const visibleCount = Math.min(maxInputLines, totalLines);
934-
935-
// Calculate which lines to show (keep cursor line visible)
936-
const cursorLine = this.lineEditor.lineIndex;
937-
let startLine = 0;
938-
939-
if (totalLines > visibleCount) {
940-
// Keep cursor visible with some context
941-
if (cursorLine < 2) {
942-
startLine = 0;
943-
} else if (cursorLine > totalLines - 3) {
944-
startLine = totalLines - visibleCount;
945-
} else {
946-
startLine = cursorLine - 2;
947-
}
948-
}
949927

950-
const endLine = Math.min(startLine + visibleCount, totalLines);
951-
952-
for (let idx = startLine; idx < endLine; idx++) {
953-
const line = this.lineEditor.lines[idx];
954-
// Show > prefix on first visible line if it's line 0, otherwise show line number hint
955-
const isFirstLogicalLine = idx === 0;
956-
const prefix = isFirstLogicalLine ? cyan('> ') : ' ';
928+
this.lineEditor.lines.forEach((line, idx) => {
929+
const prefix = idx === 0 ? cyan('> ') : ' ';
957930
let lineContent: string;
958931

959932
if (idx === this.lineEditor.lineIndex && !this.isStreaming) {
@@ -968,22 +941,19 @@ export class AICodeUI {
968941
lineContent = line;
969942
}
970943

971-
// Add info on the last visible line
972-
if (idx === endLine - 1 && hasContent) {
973-
// Show line count if multiline, otherwise show send hint
974-
const info = totalLines > 1
975-
? dim(` ln ${cursorLine + 1}/${totalLines}`)
976-
: dim(' ↵ send');
944+
// Add send hint on last line if there's content
945+
if (idx === this.lineEditor.lines.length - 1 && hasContent) {
946+
const hint = dim(' ↵ send');
977947
const lineWidth = displayWidth(prefix + lineContent);
978-
const infoWidth = displayWidth(info);
979-
if (lineWidth + infoWidth < width - 2) {
980-
const padding = width - lineWidth - infoWidth - 2;
981-
lineContent = lineContent + ' '.repeat(Math.max(0, padding)) + info;
948+
const hintWidth = displayWidth(hint);
949+
if (lineWidth + hintWidth < width - 2) {
950+
const padding = width - lineWidth - hintWidth - 2;
951+
lineContent = lineContent + ' '.repeat(Math.max(0, padding)) + hint;
982952
}
983953
}
984954

985955
lines.push(prefix + lineContent);
986-
}
956+
});
987957

988958
return lines;
989959
}

0 commit comments

Comments
 (0)