summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2021-07-04 14:02:15 +0200
committerSébastien Helleu <flashcode@flashtux.org>2021-07-04 14:02:15 +0200
commit64b52da4064dffb4de83a8f95c43f6ee4eca9cf7 (patch)
tree3fe8d9b49bd74d97b6ce038b8f0d17f24539151a /src
parent5ae4af1549b9ec3c160b7d5d1118b3aa38d8e03d (diff)
downloadweechat-64b52da4064dffb4de83a8f95c43f6ee4eca9cf7.zip
typing: add option typing.look.input_min_chars
Diffstat (limited to 'src')
-rw-r--r--src/plugins/typing/typing-config.c7
-rw-r--r--src/plugins/typing/typing-config.h1
-rw-r--r--src/plugins/typing/typing.c6
3 files changed, 12 insertions, 2 deletions
diff --git a/src/plugins/typing/typing-config.c b/src/plugins/typing/typing-config.c
index a0fda1128..368d8582a 100644
--- a/src/plugins/typing/typing-config.c
+++ b/src/plugins/typing/typing-config.c
@@ -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",
diff --git a/src/plugins/typing/typing-config.h b/src/plugins/typing/typing-config.h
index d78c091ce..d714145e5 100644
--- a/src/plugins/typing/typing-config.h
+++ b/src/plugins/typing/typing-config.h
@@ -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 ();
diff --git a/src/plugins/typing/typing.c b/src/plugins/typing/typing.c
index 003863228..d27fce1d7 100644
--- a/src/plugins/typing/typing.c
+++ b/src/plugins/typing/typing.c
@@ -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);