-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
opening selector multiple times will cause the selection to fail, is it a input.select
API bug?
#15795
Comments
That's not supported currently as the interactions with console are asynchronous so closing it and reopening it immediately unregisters the event listener of the new call. |
So there's no issue if input.lua does not depend on console.lua. another issue found earlier is that input.select() does not support nesting, which seems to be the same reason. input.select({
...
submit = function(i)
input.terminate()
input.select({
...
-- can't callback
submit = function(j)
end,
})
end,
}) |
Currently using mp.input while the console is open doesn't do anything. We can allow using mp.input multiple times in a row by keeping the console open, and sending a closed event only when the previous calling script is different from the current one. If it is the same, sending a closed event would unregister the new input-event listener, so it is just never sent in this case as there is no sane way to do it. Fixes mpv-player#15795.
Currently using mp.input while the console is open doesn't do anything. We can allow using mp.input multiple times in a row by keeping the console open, and sending a closed event only when the previous calling script is different from the current one. If it is the same, sending a closed event would unregister the new input-event listener, so it is just never sent in this case as there is no sane way to do it. Fixes mpv-player#15795.
Currently using mp.input while the console is open doesn't do anything. We can allow using mp.input multiple times in a row by keeping the console open, and sending a closed event only when the previous calling script is different from the current one. If it is the same, sending a closed event would unregister the new input-event listener, so it is just never sent in this case as there is no sane way to do it. This is useful e.g. to try out select script bindings in the console, or to switch to a different mp.input script binding with a key binding without having to close the current one. Calling input.select() again within input.select()'s submit handler needs to be fixed separately because with select the console is immediately closed on submit (367a6b5), so input.lua receives submit, requests a new selection, and receives closed wich unregisters the handler of the new selection. Just not calling mp.unregister_script_message("input-event") fixes it; its only purpose was to allow garbage collection of variables defined in the scope using mp.input. Fixes mpv-player#15795.
mpv Information
Other Information
Reproduction Steps
alt+s script-message-to console disable; script-binding select/select-sid
Expected Behavior
subtitle selected
Actual Behavior
nothing happened
Log File
log.txt
Sample Files
N/A
I carefully read all instruction and confirm that I did the following:
--log-file=output.txt
.The text was updated successfully, but these errors were encountered: