diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2017-08-21 07:41:28 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2017-08-21 07:41:28 +0200 |
commit | db0bdc2ac69c27728fa415dd452fc88bb9e92f0f (patch) | |
tree | c5ff585133bde66c7653b113bcce1d9abb0ea7fe /src/core | |
parent | 8c554d88c93a48bec48317b15d1da61fa20d6cbb (diff) | |
download | weechat-db0bdc2ac69c27728fa415dd452fc88bb9e92f0f.zip |
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.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/wee-input.c | 7 | ||||
-rw-r--r-- | src/core/wee-upgrade.c | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/core/wee-input.c b/src/core/wee-input.c index e90e31650..efbea6766 100644 --- a/src/core/wee-input.c +++ b/src/core/wee-input.c @@ -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 diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c index 3dbf05272..5da9074a8 100644 --- a/src/core/wee-upgrade.c +++ b/src/core/wee-upgrade.c @@ -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 = |