1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 13:26:38 +02:00

core: add flag "input_get_empty" in buffer

The default value is 0 (legacy behavior).
When it is set to 1, an empty input (just by pressing Return with nothing in
input) is sent to the input callback, which receives an empty string.
This commit is contained in:
Sébastien Helleu
2017-08-21 07:41:28 +02:00
parent 8c554d88c9
commit db0bdc2ac6
16 changed files with 71 additions and 9 deletions
+3 -4
View File
@@ -194,8 +194,7 @@ input_data (struct t_gui_buffer *buffer, const char *data)
rc = WEECHAT_RC_OK;
if (!buffer || !gui_buffer_valid (buffer)
|| !data || !data[0] || (data[0] == '\r') || (data[0] == '\n'))
if (!buffer || !gui_buffer_valid (buffer) || !data)
{
return WEECHAT_RC_ERROR;
}
@@ -213,12 +212,12 @@ input_data (struct t_gui_buffer *buffer, const char *data)
data);
/* data was dropped? */
if (new_data && !new_data[0])
if (data[0] && new_data && !new_data[0])
goto end;
first_command = 1;
ptr_data = (new_data) ? new_data : data;
while (ptr_data && ptr_data[0])
while (ptr_data)
{
/*
* if the buffer pointer is not valid any more (or if it's another
+3
View File
@@ -509,6 +509,9 @@ upgrade_weechat_read_buffer (struct t_infolist *infolist)
ptr_buffer->input = infolist_integer (infolist, "input");
ptr_buffer->input_get_unknown_commands =
infolist_integer (infolist, "input_get_unknown_commands");
ptr_buffer->input_get_empty =
infolist_integer (infolist, "input_get_empty");
if (infolist_integer (infolist, "input_buffer_alloc") > 0)
{
ptr_buffer->input_buffer =