mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Added autocompletion for form list-multi values
This commit is contained in:
parent
e42a0847a2
commit
fa7b6f3000
@ -2128,7 +2128,7 @@ _form_autocomplete(char *input, int *size)
|
|||||||
form_field_type_t field_type = form_get_field_type(form, tag);
|
form_field_type_t field_type = form_get_field_type(form, tag);
|
||||||
|
|
||||||
// handle boolean (set)
|
// handle boolean (set)
|
||||||
if ((g_strcmp0(args[0], "set") == 0) && field_type == FIELD_BOOLEAN) {
|
if ((g_strcmp0(args[0], "set") == 0) && field_type == FIELD_BOOLEAN) {
|
||||||
found = autocomplete_param_with_func(input, size, beginning->str,
|
found = autocomplete_param_with_func(input, size, beginning->str,
|
||||||
prefs_autocomplete_boolean_choice);
|
prefs_autocomplete_boolean_choice);
|
||||||
g_string_free(beginning, TRUE);
|
g_string_free(beginning, TRUE);
|
||||||
@ -2138,7 +2138,7 @@ _form_autocomplete(char *input, int *size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle list-single (set)
|
// handle list-single (set)
|
||||||
if ((g_strcmp0(args[0], "set") == 0) && field_type == FIELD_LIST_SINGLE) {
|
if ((g_strcmp0(args[0], "set") == 0) && field_type == FIELD_LIST_SINGLE) {
|
||||||
Autocomplete ac = form_get_value_ac(form, tag);
|
Autocomplete ac = form_get_value_ac(form, tag);
|
||||||
found = autocomplete_param_with_ac(input, size, beginning->str, ac, TRUE);
|
found = autocomplete_param_with_ac(input, size, beginning->str, ac, TRUE);
|
||||||
g_string_free(beginning, TRUE);
|
g_string_free(beginning, TRUE);
|
||||||
@ -2148,6 +2148,15 @@ _form_autocomplete(char *input, int *size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle list-multi (add, remove)
|
// handle list-multi (add, remove)
|
||||||
|
if (((g_strcmp0(args[0], "set") == 0) || (g_strcmp0(args[0], "remove") == 0))
|
||||||
|
&& field_type == FIELD_LIST_MULTI) {
|
||||||
|
Autocomplete ac = form_get_value_ac(form, tag);
|
||||||
|
found = autocomplete_param_with_ac(input, size, beginning->str, ac, TRUE);
|
||||||
|
g_string_free(beginning, TRUE);
|
||||||
|
if (found != NULL) {
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// handle text-multi (remove)
|
// handle text-multi (remove)
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ form_create(xmpp_stanza_t * const form_stanza)
|
|||||||
option->label = _get_attr(field_child, "label");
|
option->label = _get_attr(field_child, "label");
|
||||||
option->value = _get_property(field_child, "value");
|
option->value = _get_property(field_child, "value");
|
||||||
|
|
||||||
if (field->type_t == FIELD_LIST_SINGLE) {
|
if ((field->type_t == FIELD_LIST_SINGLE) || (field->type_t == FIELD_LIST_MULTI)) {
|
||||||
autocomplete_add(field->value_ac, option->value);
|
autocomplete_add(field->value_ac, option->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ _new_field(void)
|
|||||||
field->options = NULL;
|
field->options = NULL;
|
||||||
field->var = NULL;
|
field->var = NULL;
|
||||||
field->values = NULL;
|
field->values = NULL;
|
||||||
|
field->value_ac = NULL;
|
||||||
|
|
||||||
return field;
|
return field;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user