From 6d828a6b6c1663a275d17f5f39e970855b3331e3 Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Sat, 11 May 2024 19:38:30 +0200 Subject: [PATCH] console.lua: fix ctrl+f and ctrl+b keybindings With mp.input.select() these keybindings were both scrolling and moving the cursor because of how the condition was written and handle_pgup()/handle_pgdown() not returning a truthy value. --- player/lua/console.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/player/lua/console.lua b/player/lua/console.lua index 0c225b668f2ca..89acf5cc5a0a1 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -890,11 +890,19 @@ function handle_pgdown() end local function page_up_or_prev_char() - return selectable_items and handle_pgup() or prev_char() + if selectable_items then + handle_pgup() + else + prev_char() + end end local function page_down_or_next_char() - return selectable_items and handle_pgdown() or next_char() + if selectable_items then + handle_pgdown() + else + next_char() + end end -- Move to the start of the current word, or if already at the start, the start