mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge branch 'master' into nextdev
This commit is contained in:
commit
a581db3d48
@ -26,8 +26,6 @@
|
|||||||
|
|
||||||
#include "autocomplete.h"
|
#include "autocomplete.h"
|
||||||
|
|
||||||
#include "ui/ui.h"
|
|
||||||
|
|
||||||
struct autocomplete_t {
|
struct autocomplete_t {
|
||||||
GSList *items;
|
GSList *items;
|
||||||
GSList *last_found;
|
GSList *last_found;
|
||||||
@ -267,18 +265,14 @@ _count_tokens(char *string)
|
|||||||
{
|
{
|
||||||
int num_tokens = 0;
|
int num_tokens = 0;
|
||||||
|
|
||||||
cons_debug("String: %s", string);
|
|
||||||
|
|
||||||
// if no quotes, use glib
|
// if no quotes, use glib
|
||||||
if (g_strrstr(string, "\"") == NULL) {
|
if (g_strrstr(string, "\"") == NULL) {
|
||||||
cons_debug("NO QUOTES");
|
|
||||||
gchar **tokens = g_strsplit(string, " ", 0);
|
gchar **tokens = g_strsplit(string, " ", 0);
|
||||||
num_tokens = g_strv_length(tokens);
|
num_tokens = g_strv_length(tokens);
|
||||||
g_strfreev(tokens);
|
g_strfreev(tokens);
|
||||||
|
|
||||||
// else count tokens including quoted
|
// else count tokens including quoted
|
||||||
} else {
|
} else {
|
||||||
cons_debug("QUOTES");
|
|
||||||
int length = strlen(string);
|
int length = strlen(string);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
gboolean in_quotes = FALSE;
|
gboolean in_quotes = FALSE;
|
||||||
@ -360,14 +354,10 @@ autocomplete_param_no_with_func(char *input, int *size, char *command,
|
|||||||
|
|
||||||
// count tokens properly
|
// count tokens properly
|
||||||
int num_tokens = _count_tokens(inp_cpy);
|
int num_tokens = _count_tokens(inp_cpy);
|
||||||
cons_debug("tokens: %d", num_tokens);
|
|
||||||
|
|
||||||
// if correct number of tokens, then candidate for autocompletion of last param
|
// if correct number of tokens, then candidate for autocompletion of last param
|
||||||
if (num_tokens == arg_number) {
|
if (num_tokens == arg_number) {
|
||||||
|
|
||||||
gchar *start_str = _get_start(inp_cpy, arg_number);
|
gchar *start_str = _get_start(inp_cpy, arg_number);
|
||||||
cons_debug("STARTSTR: %s", start_str);
|
|
||||||
|
|
||||||
gchar *comp_str = g_strdup(&inp_cpy[strlen(start_str)]);
|
gchar *comp_str = g_strdup(&inp_cpy[strlen(start_str)]);
|
||||||
|
|
||||||
// autocomplete param
|
// autocomplete param
|
||||||
|
Loading…
Reference in New Issue
Block a user