merge PR #4641: fix: cramped slash autocomplete menu

This commit is contained in:
can1357
2026-07-08 15:19:40 +02:00
3 changed files with 26 additions and 1 deletions
+1
View File
@@ -18,6 +18,7 @@
- Fixed autocompletion for absolute paths (such as `/tmp/...` or `/Users/...`) at the start of a prompt, ensuring they fall back to file-path completion instead of being incorrectly treated as slash commands.
- Updated absolute path autocompletion behavior so that accepting a suggestion inserts the path without submitting the prompt.
- Kept slash command autocomplete rows compact by truncating descriptions instead of wrapping them into multi-line blocks.
## [16.3.7] - 2026-07-05
-1
View File
@@ -31,7 +31,6 @@ const SLASH_COMMAND_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {
minPrimaryColumnWidth: 12,
maxPrimaryColumnWidth: 32,
overflowSearch: false,
wrapDescription: true,
};
function sanitizeLoadedText(text: string): string {
+25
View File
@@ -309,6 +309,31 @@ describe("Editor component", () => {
await expect(promise).resolves.toBe("/");
});
it("renders slash-command suggestions as compact item rows", async () => {
const editor = new Editor(defaultEditorTheme);
editor.setAutocompleteMaxVisible(10);
const longDescription =
"Plan and execute non-trivial architectural improvements to the codebase without turning each slash command into a multi-line block.";
editor.setAutocompleteProvider(
new CombinedAutocompleteProvider(
Array.from({ length: 12 }, (_, i) => ({
name: `cmd${i}`,
description: longDescription,
})),
"/tmp",
),
);
editor.handleInput("/");
await Bun.sleep(0);
const rendered = editor.render(80).map(line => stripVTControlCharacters(line));
for (let i = 0; i < 10; i += 1) {
expect(rendered.some(line => line.includes(`cmd${i}`))).toBe(true);
}
expect(rendered.some(line => line.includes("cmd10"))).toBe(false);
});
it("triggers file-reference autocomplete when typing at-sign", async () => {
const editor = new Editor(defaultEditorTheme);
const { promise, resolve } = Promise.withResolvers<string>();