mp.input: avoid displaying outdated completions from the same client

Previously, completion responses from the same client would be displayed
even if the user had since changed the input, as long as a newer
complete event had already been sent. This meant that, if clients took a
sufficiently long time to return completions, then
console.lua would display completions for previous versions of the line
which were no longer valid.

This commit has the client send back the version of the line their
completions apply to, ensuring that `console.lua` displays the
correct completions.
This commit is contained in:
CogentRedTester
2026-02-20 14:27:41 +10:30
committed by Kacper Michajłow
parent c568e1539f
commit 5a1700a456
3 changed files with 3 additions and 5 deletions
+1
View File
@@ -678,6 +678,7 @@ function register_event_handler(t) {
mp.commandv("script-message-to", "console", "complete", JSON.stringify({
client_name: mp.script_name,
handler_id: handler_id,
original_line: args[0],
list: completions,
start_pos: completion_pos,
append: completion_append || "",