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 authored and Kacper Michajłow committed 2026-02-24 20:19:24 +01:00
1 parent c568e1539f
commit 5a1700a456
3 files changed
+3 -5

No files matched your search

+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 || "",