From 2a1485772bf84b5f56f379946d3b09e6d9feb32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Tue, 24 Sep 2024 18:49:34 +0200 Subject: [PATCH] console.lua: clear terminal msg after changing to OSD display --- player/lua/console.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/player/lua/console.lua b/player/lua/console.lua index 3c69d1456b..b232b878c4 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -78,6 +78,7 @@ local terminal_styles = { } local repl_active = false +local osd_msg_active = false local insert_mode = false local pending_update = false local line = '' @@ -472,6 +473,7 @@ local function print_to_terminal() -- Clear the log after closing the console. if not repl_active then mp.osd_message('') + osd_msg_active = false return end @@ -503,6 +505,7 @@ local function print_to_terminal() mp.osd_message(log .. suggestions .. prompt .. ' ' .. before_cur .. '\027[7m' .. after_cur:sub(1, 1) .. '\027[0m' .. after_cur:sub(2), 999) + osd_msg_active = true end -- Render the REPL and console as an ASS OSD @@ -516,6 +519,12 @@ local function update() return end + -- Clear the OSD if the console was being printed to the terminal + if osd_msg_active then + mp.osd_message('') + osd_msg_active = false + end + -- Clear the OSD if the REPL is not active if not repl_active then mp.set_osd_ass(0, 0, '')