merge PR #5475 via eval/pr-5475: fix(tui): aligned ask "Other" custom-input chrome to prompt gutter
This commit is contained in:
@@ -238,6 +238,10 @@
|
||||
- Fixed rendering, status display, and PTY control sequence formatting issues in the `launch` tool.
|
||||
- Fixed in-process shell builtins (including `stat`, `date`, `sed`, `mktemp`, `tail`, `find`, `base64`, and `ln`) to correctly detect and translate macOS/BSD-style arguments and flags, preventing failures caused by GNU-only assumptions.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed the ask tool's "Other" custom-input dialog rendering the title, options, and hint one column to the right of the `> ` input gutter; the prompt-style editor chrome now aligns to column 0 ([#5313](https://github.com/can1357/oh-my-pi/issues/5313))
|
||||
|
||||
### Removed
|
||||
|
||||
- Removed the `--prewalk-boomerang` feature and its associated configuration setting.
|
||||
|
||||
@@ -50,8 +50,11 @@ export class HookEditorComponent extends Container implements Focusable {
|
||||
this.addChild(new DynamicBorder());
|
||||
this.addChild(new Spacer(1));
|
||||
|
||||
// Title
|
||||
this.addChild(new Text(theme.fg("accent", title), 1, 0));
|
||||
// Title. Prompt-style renders the borderless editor's `> ` gutter at
|
||||
// column 0, so pad the title to match; hook-style keeps the 1-col indent
|
||||
// that lines up with its bordered editor body (#5313).
|
||||
const chromePadX = this.#promptStyle ? 0 : 1;
|
||||
this.addChild(new Text(theme.fg("accent", title), chromePadX, 0));
|
||||
this.addChild(new Spacer(1));
|
||||
|
||||
// Editor
|
||||
@@ -72,7 +75,7 @@ export class HookEditorComponent extends Container implements Focusable {
|
||||
const hint = this.#promptStyle
|
||||
? "enter or ctrl+q submit esc cancel ctrl+g external editor"
|
||||
: "ctrl+q/ctrl+enter submit esc cancel ctrl+g external editor";
|
||||
this.addChild(new Text(theme.fg("dim", hint), 1, 0));
|
||||
this.addChild(new Text(theme.fg("dim", hint), chromePadX, 0));
|
||||
|
||||
this.addChild(new Spacer(1));
|
||||
this.addChild(new DynamicBorder());
|
||||
|
||||
@@ -359,7 +359,7 @@ describe("HookEditorComponent prompt-style mode", () => {
|
||||
expect(lines[0]).toMatch(/^─+$/);
|
||||
expect(lines.at(-1)).toMatch(/^─+$/);
|
||||
expect(lines[4]?.startsWith("> ")).toBe(true);
|
||||
expect(rendered).toContain(" enter or ctrl+q submit esc cancel");
|
||||
expect(rendered).toContain("enter or ctrl+q submit esc cancel");
|
||||
expect(rendered).not.toContain("shift+enter newline");
|
||||
expect(rendered).toContain("ctrl+g external editor");
|
||||
});
|
||||
@@ -431,6 +431,26 @@ describe("HookEditorComponent prompt-style mode", () => {
|
||||
expect(onCancel).toHaveBeenCalledTimes(1);
|
||||
expect(onSubmit).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("aligns the title and hint with the editor prompt gutter at column zero (#5313)", () => {
|
||||
const title = "◆ Other (type your own)\nEnter your response:";
|
||||
const component = new HookEditorComponent(createTui(), title, "不太清楚,", vi.fn(), vi.fn(), {
|
||||
promptStyle: true,
|
||||
});
|
||||
const lines = renderLines(component);
|
||||
|
||||
const titleRow = lines.find(line => line.includes("Enter your response:"));
|
||||
const gutterRow = lines.find(line => line.startsWith("> "));
|
||||
const hintRow = lines.find(line => line.includes("esc cancel"));
|
||||
|
||||
expect(titleRow).toBeDefined();
|
||||
expect(gutterRow).toBeDefined();
|
||||
expect(hintRow).toBeDefined();
|
||||
// The borderless prompt-style editor renders `> ` starting at column 0, so
|
||||
// the surrounding title/hint chrome must not carry a leading indent.
|
||||
expect(titleRow!.startsWith("Enter your response:")).toBe(true);
|
||||
expect(hintRow!.startsWith(" ")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("ExtensionUiController hook editor abort", () => {
|
||||
|
||||
Reference in New Issue
Block a user