xonecas.io
64875
Mc

mini-coder / commit 0730e4c

fix(ui): render input directly for two-line minimum height

xonecas2026-04-07 0730e4c464b00d77005f49ceb1bd26b0b27ef756 parent 9eb207e

3 files changed

spec.md+1−3
@@ -419,9 +419,7 @@ VStack({ height: "100%" }, [
419419 // Top divider — animated scanning pulse when agent is working
420420 Divider(),
421421 // Input area — intrinsic height, no prompt prefix; starts at 2 lines
422- VStack({ padding: { x: 1 } }, [
423- TextInput({ flex: 1, minHeight: 2, maxHeight: 10 }),
424- ]),
422+ TextInput({ minHeight: 2, maxHeight: 10, padding: { x: 1 } }),
425423 // Status pills — fixed 1 line, backgrounds only behind the text
426424 HStack({ height: 1, padding: { x: 1 } }, [
427425 statusPill(modelInfo, theme.statusPrimaryBg),
src/ui.test.ts+9−18
@@ -722,40 +722,31 @@ describe("ui rendering", () => {
722722 }
723723 });
724724
725- test("renderInputArea reuses stable TextInput handlers from the input controller", () => {
725+ test("renderInputArea returns a direct TextInput with stable handlers", () => {
726726 const state = createTestState();
727727
728728 try {
729729 const controller = createInputController(state);
730- const first = renderInputArea(state.theme, controller);
731- const second = renderInputArea(state.theme, controller);
730+ const firstInput = renderInputArea(state.theme, controller);
731+ const secondInput = renderInputArea(state.theme, controller);
732732
733- expect(first.type).toBe("vstack");
734- expect(second.type).toBe("vstack");
735- if (first.type !== "vstack" || second.type !== "vstack") {
736- throw new Error("Expected input area wrappers to be VStack nodes");
737- }
738-
739- const firstInput = first.children[0];
740- const secondInput = second.children[0];
741- expect(firstInput?.type).toBe("textinput");
742- expect(secondInput?.type).toBe("textinput");
743- if (!firstInput || !secondInput) {
744- throw new Error("Expected text input children to exist");
745- }
733+ expect(firstInput.type).toBe("textinput");
734+ expect(secondInput.type).toBe("textinput");
746735 if (firstInput.type !== "textinput" || secondInput.type !== "textinput") {
747- throw new Error("Expected text input child nodes");
736+ throw new Error("Expected direct TextInput nodes");
748737 }
749738
750739 expect(firstInput.props.placeholder?.props.fgColor).toBe(
751740 state.theme.mutedText,
752741 );
742+ expect(firstInput.props.padding).toEqual({ x: 1 });
753743 expect(firstInput.props.minHeight).toBe(2);
754744 expect(firstInput.props.maxHeight).toBe(10);
755745 expect(firstInput.props.onChange).toBe(controller.onChange);
756746 expect(firstInput.props.onFocus).toBe(controller.onFocus);
757747 expect(firstInput.props.onBlur).toBe(controller.onBlur);
758748 expect(firstInput.props.onKeyPress).toBe(controller.onKeyPress);
749+ expect(secondInput.props.padding).toEqual(firstInput.props.padding);
759750 expect(secondInput.props.minHeight).toBe(firstInput.props.minHeight);
760751 expect(secondInput.props.maxHeight).toBe(firstInput.props.maxHeight);
761752 expect(secondInput.props.onChange).toBe(firstInput.props.onChange);
@@ -906,7 +897,7 @@ describe("ui rendering", () => {
906897 expect(node.children).toHaveLength(4);
907898 expect(node.children[0]?.type).toBe("vstack");
908899 expect(node.children[1]?.type).toBe("text");
909- expect(node.children[2]?.type).toBe("vstack");
900+ expect(node.children[2]?.type).toBe("textinput");
910901 expect(node.children[3]?.type).toBe("hstack");
911902 } finally {
912903 state.db.close();
src/ui.ts+13−15
@@ -1117,7 +1117,7 @@ export function createInputController(state: AppState): InputController {
11171117 }
11181118
11191119 /**
1120- * Render the padded input area.
1120+ * Render the input area.
11211121 *
11221122 * @param theme - Active UI theme.
11231123 * @param controller - Stable TextInput callbacks.
@@ -1127,20 +1127,18 @@ export function renderInputArea(
11271127 theme: Theme,
11281128 controller: InputController,
11291129 ): Node {
1130- return VStack({ padding: { x: 1 } }, [
1131- TextInput({
1132- flex: 1,
1133- minHeight: 2,
1134- maxHeight: 10,
1135- value: inputValue,
1136- onChange: controller.onChange,
1137- placeholder: Text("message…", { fgColor: theme.mutedText }),
1138- focused: inputFocused,
1139- onFocus: controller.onFocus,
1140- onBlur: controller.onBlur,
1141- onKeyPress: controller.onKeyPress,
1142- }),
1143- ]);
1130+ return TextInput({
1131+ minHeight: 2,
1132+ maxHeight: 10,
1133+ padding: { x: 1 },
1134+ value: inputValue,
1135+ onChange: controller.onChange,
1136+ placeholder: Text("message…", { fgColor: theme.mutedText }),
1137+ focused: inputFocused,
1138+ onFocus: controller.onFocus,
1139+ onBlur: controller.onBlur,
1140+ onKeyPress: controller.onKeyPress,
1141+ });
11441142 }
11451143
11461144 // ---------------------------------------------------------------------------