console.lua: clear terminal msg after changing to OSD display

This commit is contained in:
Kacper Michajłow 2024-09-24 18:49:34 +02:00
parent 2c5928e518
commit 2a1485772b
1 changed files with 9 additions and 0 deletions

View File

@ -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, '')