Showing the changes to player/lua/console.lua (1 of 1 file). Show all
Unified · Split
| @@ -78,6 +78,7 @@ local terminal_styles = { · 77 unmodified lines | ||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | local repl_active = false |
| 81 | +local osd_msg_active = false | |
| 81 | 82 | local insert_mode = false |
| 82 | 83 | local pending_update = false |
| 83 | 84 | local line = '' |
| @@ -472,6 +473,7 @@ local function print_to_terminal() · 388 unmodified lines | ||
| 472 | 473 | -- Clear the log after closing the console. |
| 473 | 474 | if not repl_active then |
| 474 | 475 | mp.osd_message('') |
| 476 | + osd_msg_active = false | |
| 475 | 477 | return |
| 476 | 478 | end |
| 477 | 479 | |
| @@ -503,6 +505,7 @@ local function print_to_terminal() · 25 unmodified lines | ||
| 503 | 505 | mp.osd_message(log .. suggestions .. prompt .. ' ' .. before_cur .. |
| 504 | 506 | '\027[7m' .. after_cur:sub(1, 1) .. '\027[0m' .. |
| 505 | 507 | after_cur:sub(2), 999) |
| 508 | + osd_msg_active = true | |
| 506 | 509 | end |
| 507 | 510 | |
| 508 | 511 | -- Render the REPL and console as an ASS OSD |
| @@ -516,6 +519,12 @@ local function update() · 7 unmodified lines | ||
| 516 | 519 | return |
| 517 | 520 | 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 | 528 | -- Clear the OSD if the REPL is not active |
| 520 | 529 | if not repl_active then |
| 521 | 530 | mp.set_osd_ass(0, 0, '') |