From 1100b0e69497e9714c8119b2a7b6ca1f13d27616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Thu, 16 May 2024 07:22:24 +0200 Subject: [PATCH] relay/remote: set "input" and "input_pos" only upon buffer creation This prevents unexpected updates of input on remote buffer whenever something changes in the buffer, like a local variable, but with the same unchanged input. --- src/plugins/relay/api/remote/relay-remote-event.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/plugins/relay/api/remote/relay-remote-event.c b/src/plugins/relay/api/remote/relay-remote-event.c index 90e775246..caed639e9 100644 --- a/src/plugins/relay/api/remote/relay-remote-event.c +++ b/src/plugins/relay/api/remote/relay-remote-event.c @@ -516,9 +516,16 @@ RELAY_REMOTE_EVENT_CALLBACK(buffer) weechat_hashtable_set (buffer_props, "title", title); weechat_hashtable_set (buffer_props, "modes", modes); weechat_hashtable_set (buffer_props, "input_prompt", input_prompt); - weechat_hashtable_set (buffer_props, "input", input); - snprintf (str_number, sizeof (str_number), "%d", input_position); - weechat_hashtable_set (buffer_props, "input_pos", str_number); + if (!event->buffer) + { + /* + * set input content and position only when the buffer is created; + * subsequent updates will be handled via the "input" callback + */ + weechat_hashtable_set (buffer_props, "input", input); + snprintf (str_number, sizeof (str_number), "%d", input_position); + weechat_hashtable_set (buffer_props, "input_pos", str_number); + } weechat_hashtable_set (buffer_props, "input_multiline", (input_multiline) ? "1" : "0"); weechat_hashtable_set (buffer_props, "nicklist", (nicklist) ? "1" : "0");