summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-05-08 13:13:52 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-05-08 13:19:40 +0200
commit7addd1bf0070c8b6c36f6e1d90245c44f742d7ee (patch)
treefb45297afbddf07e073c2a7adf5df71c464532a2 /src/gui
parent28f75d17dc6ec1ae7b082cd576093531a9d15614 (diff)
downloadweechat-7addd1bf0070c8b6c36f6e1d90245c44f742d7ee.zip
core: add function gui_buffer_set_input
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui-buffer.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index f2716054f..e671278b8 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -2274,6 +2274,23 @@ gui_buffer_remove_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
}
/*
+ * Sets buffer input.
+ */
+
+void
+gui_buffer_set_input (struct t_gui_buffer *buffer, const char *input)
+{
+ if (!buffer || (string_strcmp (buffer->input_buffer, input) == 0))
+ return;
+
+ gui_buffer_undo_snap (buffer);
+ gui_input_replace_input (buffer, input);
+ gui_input_text_changed_modifier_and_signal (buffer,
+ 1, /* save undo */
+ 1); /* stop completion */
+}
+
+/*
* Sets flag "input_get_any_user_data" for a buffer.
*/
@@ -2677,11 +2694,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
}
else if (strcmp (property, "input") == 0)
{
- gui_buffer_undo_snap (buffer);
- gui_input_replace_input (buffer, value);
- gui_input_text_changed_modifier_and_signal (buffer,
- 1, /* save undo */
- 1); /* stop completion */
+ gui_buffer_set_input (buffer, value);
}
else if (strcmp (property, "input_pos") == 0)
{