From 063410fa040e1239a4c7cd448ff27db0a71081cf Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Mon, 2 Dec 2024 19:52:32 +0100 Subject: [PATCH] console.lua: don't reinsert the next characters on complete This avoids inserting the characters in front of the cursor again when completing to text already in front of the cursor. This is important after 2f271a92de made Enter automatically insert the first completion. --- player/lua/console.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/player/lua/console.lua b/player/lua/console.lua index 806d43b082..c4c3dcc30c 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -1431,7 +1431,8 @@ cycle_through_suggestions = function (backwards) local before_cur = line:sub(1, completion_pos - 1) .. suggestion_buffer[selected_suggestion_index] .. completion_append - line = before_cur .. strip_common_characters(line:sub(cursor), completion_append) + line = before_cur .. strip_common_characters(line:sub(cursor), + suggestion_buffer[selected_suggestion_index] .. completion_append) cursor = before_cur:len() + 1 update() end