History

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

Kacper Michajłow committed 2 years ago

Commit 2a148571 parent 2c5928e1 file · +9 −0Browse files

Showing the changes to player/lua/console.lua (1 of 1 file). Show all

Unified · Split

player/lua/console.lua+9−0
@@ -78,6 +78,7 @@ local terminal_styles = { · 77 unmodified lines
7878 }
7979
8080 local repl_active = false
81+local osd_msg_active = false
8182 local insert_mode = false
8283 local pending_update = false
8384 local line = ''
@@ -472,6 +473,7 @@ local function print_to_terminal() · 388 unmodified lines
472473 -- Clear the log after closing the console.
473474 if not repl_active then
474475 mp.osd_message('')
476+ osd_msg_active = false
475477 return
476478 end
477479
@@ -503,6 +505,7 @@ local function print_to_terminal() · 25 unmodified lines
503505 mp.osd_message(log .. suggestions .. prompt .. ' ' .. before_cur ..
504506 '\027[7m' .. after_cur:sub(1, 1) .. '\027[0m' ..
505507 after_cur:sub(2), 999)
508+ osd_msg_active = true
506509 end
507510
508511 -- Render the REPL and console as an ASS OSD
@@ -516,6 +519,12 @@ local function update() · 7 unmodified lines
516519 return
517520 end
518521
522+ -- Clear the OSD if the console was being printed to the terminal
523+ if osd_msg_active then
524+ mp.osd_message('')
525+ osd_msg_active = false
526+ end
527+
519528 -- Clear the OSD if the REPL is not active
520529 if not repl_active then
521530 mp.set_osd_ass(0, 0, '')

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t