about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-07-09 22:34:55 +0100
committerJames Booth <boothj5@gmail.com>2013-07-09 22:34:55 +0100
commite99a0e117a51436932d90aee5d5c1c12c5cf7681 (patch)
tree0bb0858cad5ce46a7a7c21be54ad78cd5edd6df6 /src/command
parent581c1e8b951d7b9841cec56d5ebf9d3c138e6ce9 (diff)
downloadprofani-tty-e99a0e117a51436932d90aee5d5c1c12c5cf7681.tar.gz
Fix autocompletion of quoted strings - WIP
Needs some refactoring
Need to use unicode functions in:
    parser.c
    autocomplete.c
Diffstat (limited to 'src/command')
-rw-r--r--src/command/parser.c18
1 files changed, 14 insertions, 4 deletions
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 = &copy[i];
-                token_size++;
+                if (copy[i] == '"') {
+                    token_start = &copy[i+1];
+                } else {
+                    token_start = &copy[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++;
+                    }
                 }
             }
         }