console.lua: add user-data/mpv/console/open

Fixes #15762.
This commit is contained in:
Guido Cella
2025-01-30 20:18:58 +01:00
committed by Kacper Michajłow
parent 17e4cc5397
commit 8669205d92
2 changed files with 9 additions and 0 deletions

View File

@@ -1780,6 +1780,7 @@ set_active = function (active)
insert_mode = false
pause_playback()
define_key_bindings()
mp.set_property_bool('user-data/mpv/console/open', true)
if not input_caller then
prompt = default_prompt
@@ -1804,6 +1805,7 @@ set_active = function (active)
completion_buffer = {}
undefine_key_bindings()
mp.enable_messages('silent:terminal-default')
mp.set_property_bool('user-data/mpv/console/open', false)
if input_caller then
mp.commandv('script-message-to', input_caller, 'input-event',
@@ -1998,6 +2000,10 @@ mp.register_event('log-message', function(e)
terminal_styles[e.level])
end)
mp.register_event('shutdown', function ()
mp.del_property('user-data/mpv/console')
end)
require 'mp.options'.read_options(opts, nil, render)
collectgarbage()