diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-05-08 13:13:52 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-05-08 13:19:40 +0200 |
commit | 7addd1bf0070c8b6c36f6e1d90245c44f742d7ee (patch) | |
tree | fb45297afbddf07e073c2a7adf5df71c464532a2 /src/gui | |
parent | 28f75d17dc6ec1ae7b082cd576093531a9d15614 (diff) | |
download | weechat-7addd1bf0070c8b6c36f6e1d90245c44f742d7ee.zip |
core: add function gui_buffer_set_input
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui-buffer.c | 23 |
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) { |