From: Daniel Carl Date: Sat, 30 Mar 2013 14:46:25 +0000 (+0100) Subject: Removed to much g_strstrip() from commands. X-Git-Url: https://git.owens.tech/git.owens.tech/git.owens.tech/git?a=commitdiff_plain;h=bd227b6f90ab2be4921d82f73d053a71ccb43320;p=vimb.git Removed to much g_strstrip() from commands. Normally we, don't need to trim trailing whitespace to run the commands properly. So it's enough to remove leading whitespace. If also trailing whitespace is removed, commands like 'input :open ' won't work anymore, because they contain essential tailing whitespace. --- diff --git a/src/command.c b/src/command.c index f00eeb3..6058d86 100644 --- a/src/command.c +++ b/src/command.c @@ -156,7 +156,8 @@ gboolean command_run_string(const char *input) } str =g_strdup(input); - g_strstrip(str); + /* remove leading whitespace */ + g_strchug(str); /* get a possible command count */ vb.state.count = g_ascii_strtoll(str, &command, 10); @@ -181,19 +182,15 @@ gboolean command_run_string(const char *input) gboolean command_run_multi(const Arg *arg) { gboolean result = TRUE; - char **commands, *input; + char **commands; unsigned int len, i; if (!arg->s || *(arg->s) == '\0') { return false; } - input = g_strdup(arg->s); - g_strstrip(input); - /* splits the commands */ - commands = g_strsplit(input, "|", 0); - g_free(input); + commands = g_strsplit(arg->s, "|", 0); len = g_strv_length(commands); if (!len) {