From 89da9deafe31c9a76803760d6fd0efd5bbec41e6 Mon Sep 17 00:00:00 2001 From: verygoodlee <45035465+verygoodlee@users.noreply.github.com> Date: Tue, 16 Jun 2026 16:57:16 +0800 Subject: [PATCH] console.lua: do not allow typing newlines when searching for menu items newline makes no sense in such case, as there're no line breaks in the selectable items. and it also causes a bug where the cursor may move outside the background box. --- player/lua/console.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/player/lua/console.lua b/player/lua/console.lua index f40762ebce..bca4fb65d6 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -1419,6 +1419,9 @@ end -- clipboard or the primary selection buffer is used (on X11 and Wayland only.) local function paste(clip) local text = get_clipboard(clip) + if selectable_items then + text = text:gsub("\r?\n", " ") + end local before_cur = line:sub(1, cursor - 1) local after_cur = line:sub(cursor) line = before_cur .. text .. after_cur @@ -1536,7 +1539,7 @@ local function get_bindings() { "ctrl+[", function() set_active(false) end }, { "enter", submit }, { "kp_enter", submit }, - { "shift+enter", function() handle_char_input("\n") end }, + { "shift+enter", function() if not selectable_items then handle_char_input("\n") end end }, { "ctrl+j", submit }, { "ctrl+m", submit }, { "bs", handle_backspace },