From db5990792535fb4783d5737cf6f3b0ea500ed7dd Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Sun, 13 Oct 2024 18:55:47 +0200 Subject: [PATCH] console.lua: trim commands before saving them in history This avoids storing similar commands in history that only differ by leading or trailing whitespace, like "sub-reload" and "sub-reload ". It is easy to get these otherwise because Tab completion leaves a trailing space after commands. --- player/lua/console.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/player/lua/console.lua b/player/lua/console.lua index f26a7e2ec10dd..2de766919c18c 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -796,6 +796,8 @@ local function handle_enter() return end + line = line:match('^%s*(.-)%s*$') + if line == '' and input_caller == nil then return end