diff --git a/player/javascript/defaults.js b/player/javascript/defaults.js index 972f87d813..6ac5b5e9ee 100644 --- a/player/javascript/defaults.js +++ b/player/javascript/defaults.js @@ -664,9 +664,6 @@ function register_event_handler(t) { JSON.stringify(result[0]), result[1]); } } - - if (type == "closed") - mp.unregister_script_message("input-event"); }) } diff --git a/player/lua/console.lua b/player/lua/console.lua index 027d1f1869..ec9fa55bfd 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -1839,8 +1839,9 @@ mp.register_script_message('type', function(text, cursor_pos) end) mp.register_script_message('get-input', function (script_name, args) - if repl_active then - return + if repl_active and input_caller and script_name ~= input_caller then + mp.commandv('script-message-to', input_caller, 'input-event', + 'closed', utils.format_json({line, cursor})) end input_caller = script_name @@ -1856,6 +1857,7 @@ mp.register_script_message('get-input', function (script_name, args) end history = histories[id] history_pos = #history + 1 + searching_history = false if args.items then selectable_items = {} @@ -1865,6 +1867,9 @@ mp.register_script_message('get-input', function (script_name, args) default_item = args.default_item handle_edit() bind_mouse() + else + selectable_items = nil + unbind_mouse() end set_active(true) diff --git a/player/lua/input.lua b/player/lua/input.lua index aadab383cc..196d61213b 100644 --- a/player/lua/input.lua +++ b/player/lua/input.lua @@ -41,10 +41,6 @@ local function register_event_handler(t) utils.format_json(suggestions), completion_start_position) end end - - if type == "closed" then - mp.unregister_script_message("input-event") - end end) end