1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

core: add function gui_buffer_set_input

This commit is contained in:
Sébastien Helleu
2024-05-08 13:13:52 +02:00
parent 28f75d17dc
commit 7addd1bf00
2 changed files with 28 additions and 5 deletions
+18 -5
View File
@@ -2273,6 +2273,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)
{
+10
View File
@@ -1207,6 +1207,16 @@ TEST(GuiBuffer, RemoveHotlistMaxLevelNicks)
/* TODO: write tests */
}
/*
* Tests functions:
* gui_buffer_set_input
*/
TEST(GuiBuffer, SetInput)
{
/* TODO: write tests */
}
/*
* Tests functions:
* gui_buffer_set_input_get_any_user_data