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 | local repl_active = false | 80 | local repl_active = false |
| 81 | local osd_msg_active = false | ||
| 81 | local insert_mode = false | 82 | local insert_mode = false |
| 82 | local pending_update = false | 83 | local pending_update = false |
| 83 | local line = '' | 84 | local 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 then | 474 | if not repl_active then |
| 474 | mp.osd_message('') | 475 | mp.osd_message('') |
| 476 | osd_msg_active = false | ||
| 475 | return | 477 | return |
| 476 | end | 478 | 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 | ||
| 506 | end | 509 | end |
| 507 | 510 | ||
| 508 | -- Render the REPL and console as an ASS OSD | 511 | -- Render the REPL and console as an ASS OSD |
| @@ -516,6 +519,12 @@ local function update() · 7 unmodified lines | |||
| 516 | return | 519 | return |
| 517 | end | 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 | -- Clear the OSD if the REPL is not active | 528 | -- Clear the OSD if the REPL is not active |
| 520 | if not repl_active then | 529 | if not repl_active then |
| 521 | mp.set_osd_ass(0, 0, '') | 530 | mp.set_osd_ass(0, 0, '') |