From e99a0e117a51436932d90aee5d5c1c12c5cf7681 Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 9 Jul 2013 22:34:55 +0100 Subject: Fix autocompletion of quoted strings - WIP Needs some refactoring Need to use unicode functions in: parser.c autocomplete.c --- src/command/parser.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/command') diff --git a/src/command/parser.c b/src/command/parser.c index af01ddcc..d7dfebab 100644 --- a/src/command/parser.c +++ b/src/command/parser.c @@ -201,8 +201,14 @@ parse_args_with_freetext(const char * const inp, int min, int max) in_quotes = TRUE; i++; } - token_start = ©[i]; - token_size++; + if (copy[i] == '"') { + token_start = ©[i+1]; + } else { + token_start = ©[i]; + } + if (copy[i] != '"') { + token_size++; + } } } else { if (in_quotes) { @@ -213,7 +219,9 @@ parse_args_with_freetext(const char * const inp, int min, int max) in_token = FALSE; in_quotes = FALSE; } else { - token_size++; + if (copy[i] != '"') { + token_size++; + } } } else { if ((!in_freetext && copy[i] == ' ') || copy[i] == '\0') { @@ -222,7 +230,9 @@ parse_args_with_freetext(const char * const inp, int min, int max) token_size = 0; in_token = FALSE; } else { - token_size++; + if (copy[i] != '"') { + token_size++; + } } } } -- cgit 1.4.1-2-gfad0