1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 05:46:38 +02:00

typing: add option typing.look.input_min_chars

This commit is contained in:
Sébastien Helleu
2021-07-04 14:02:15 +02:00
parent 5ae4af1549
commit 64b52da406
24 changed files with 113 additions and 17 deletions
+7
View File
@@ -41,6 +41,7 @@ struct t_config_option *typing_config_look_delay_purge_typing;
struct t_config_option *typing_config_look_delay_set_paused;
struct t_config_option *typing_config_look_enabled_nicks;
struct t_config_option *typing_config_look_enabled_self;
struct t_config_option *typing_config_look_input_min_chars;
struct t_config_option *typing_config_look_item_max_length;
@@ -170,6 +171,12 @@ typing_config_init ()
NULL, NULL, NULL,
&typing_config_change_enabled, NULL, NULL,
NULL, NULL, NULL);
typing_config_look_input_min_chars = weechat_config_new_option (
typing_config_file, ptr_section,
"input_min_chars", "integer",
N_("min number of chars in message to trigger send of typing signals"),
NULL, 1, INT_MAX, "4", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
typing_config_look_item_max_length = weechat_config_new_option (
typing_config_file, ptr_section,
"item_max_length", "integer",
+1
View File
@@ -27,6 +27,7 @@ extern struct t_config_option *typing_config_look_delay_purge_typing;
extern struct t_config_option *typing_config_look_delay_set_paused;
extern struct t_config_option *typing_config_look_enabled_nicks;
extern struct t_config_option *typing_config_look_enabled_self;
extern struct t_config_option *typing_config_look_input_min_chars;
extern struct t_config_option *typing_config_look_item_max_length;
extern int typing_config_init ();
+4 -2
View File
@@ -102,7 +102,7 @@ typing_input_text_changed_signal_cb (const void *pointer, void *data,
const char *signal,
const char *type_data, void *signal_data)
{
int text_search;
int text_search, input_valid;
const char *ptr_input, *ptr_input_for_buffer;
struct t_gui_buffer *ptr_buffer;
struct t_typing_status *ptr_typing_status;
@@ -121,8 +121,10 @@ typing_input_text_changed_signal_cb (const void *pointer, void *data,
return WEECHAT_RC_OK;
ptr_input = weechat_buffer_get_string (ptr_buffer, "input");
input_valid = (ptr_input && ptr_input[0]) ?
weechat_utf8_strlen (ptr_input) >= weechat_config_integer (typing_config_look_input_min_chars) : 0;
if (ptr_input && ptr_input[0])
if (input_valid)
{
/* input is a command? ignore it */
ptr_input_for_buffer = weechat_string_input_for_buffer (ptr_input);