From 8d01829750a444ddf4ee98cf0fd8f125f4319c91 Mon Sep 17 00:00:00 2001 From: Chris Angelico Date: Fri, 26 Jul 2024 21:27:19 +1000 Subject: [PATCH] commands: Include the " " entry as its own option --- httpstatic/command_gui.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/httpstatic/command_gui.js b/httpstatic/command_gui.js index d89a4c1a..61808491 100644 --- a/httpstatic/command_gui.js +++ b/httpstatic/command_gui.js @@ -1684,17 +1684,8 @@ function find_tab_completion(mle) { const linestart = content.lastIndexOf("\n", cursor - 1); const line = content.slice(linestart === -1 ? 0 : linestart + 1, cursor); //just what's behind the cursor, not anything after it if (line[0] === "/" && !line.includes(' ')) { - const cmds = Object.keys(slash_commands).filter(c => c.startsWith(line.slice(1))); - if (!cmds.length) return null; - if (cmds.length === 1) { - //If the command has parameters, insert a space after the command name. - //This can be recognized by having " -> " (with the trailing space) in - //the command description; with no parameters, it's just " ->" at the - //very end of the description. - const space = slash_commands[cmds[0]].includes(" -> ") ? " " : ""; - return cmds[0].slice(line.length - 1) + space; - } - return cmds.map(c => c.slice(line.length - 1)).filter(Boolean); + return Object.keys(slash_commands).filter(c => c.startsWith(line.slice(1))) + .map(c => c.slice(line.length - 1) + " "); } }