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
78}78}
79 79
80local repl_active = false80local repl_active = false
81local osd_msg_active = false
81local insert_mode = false82local insert_mode = false
82local pending_update = false83local pending_update = false
83local line = ''84local line = ''
@@ -472,6 +473,7 @@ local function print_to_terminal() · 388 unmodified lines
472 -- Clear the log after closing the console.473 -- Clear the log after closing the console.
473 if not repl_active then474 if not repl_active then
474 mp.osd_message('')475 mp.osd_message('')
476 osd_msg_active = false
475 return477 return
476 end478 end
477 479
@@ -503,6 +505,7 @@ local function print_to_terminal() · 25 unmodified lines
503 mp.osd_message(log .. suggestions .. prompt .. ' ' .. before_cur ..505 mp.osd_message(log .. suggestions .. prompt .. ' ' .. before_cur ..
504 '\027[7m' .. after_cur:sub(1, 1) .. '\027[0m' ..506 '\027[7m' .. after_cur:sub(1, 1) .. '\027[0m' ..
505 after_cur:sub(2), 999)507 after_cur:sub(2), 999)
508 osd_msg_active = true
506end509end
507 510
508-- Render the REPL and console as an ASS OSD511-- Render the REPL and console as an ASS OSD
@@ -516,6 +519,12 @@ local function update() · 7 unmodified lines
516 return519 return
517 end520 end
518 521
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
519 -- Clear the OSD if the REPL is not active528 -- Clear the OSD if the REPL is not active
520 if not repl_active then529 if not repl_active then
521 mp.set_osd_ass(0, 0, '')530 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