Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Tue, 10 Apr 2012 02:21:59
Commit: 78432b5806f492843af3eaf9a696e600fc4aad06
https://github.com/geany/geany/commit/78432b5806f492843af3eaf9a696e600fc4aa…
Log Message:
-----------
Find in files: split extra options like a shell would do
Don't simply split the the extra options string on spaces to build the
grep argument list but rather split it in a shell-style fashion.
This is probably more intuitive for most users, is more consistent with
e.g. custom commands, and allows for spaces in an option or its
argument.
Closes #3516263.
Modified Paths:
--------------
NEWS
src/search.c
Modified: NEWS
4 files changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -3,6 +3,10 @@ Geany 1.22 (unreleased)
Editor
* Update Scintilla to version 2.29.
+ Search
+ * Extra options passed to grep through Find in Files now follows a
+ real shell-style syntax (#3516263).
+
Geany 0.21 (October 2, 2011)
Modified: src/search.c
13 files changed, 9 insertions(+), 4 deletions(-)
===================================================================
@@ -1551,7 +1551,7 @@ static void replace_in_session(GeanyDocument *doc,
gchar **argv_prefix, **argv, **opts_argv;
gchar *command_grep;
gchar *search_text = NULL;
- guint opts_argv_len, i;
+ gint opts_argv_len, i;
GPid child_pid;
gint stdout_fd;
gint stderr_fd;
@@ -1569,6 +1569,14 @@ static void replace_in_session(GeanyDocument *doc,
return FALSE;
}
+ if (! g_shell_parse_argv(opts, &opts_argv_len, &opts_argv, &error))
+ {
+ ui_set_statusbar(TRUE, _("Cannot parse extra options: %s"), error->message);
+ g_error_free(error);
+ g_free(command_grep);
+ return FALSE;
+ }
+
/* convert the search text in the preferred encoding (if the text is not valid UTF-8. assume
* it is already in the preferred encoding) */
utf8_text_len = strlen(utf8_search_text);
@@ -1579,9 +1587,6 @@ static void replace_in_session(GeanyDocument *doc,
if (search_text == NULL)
search_text = g_strdup(utf8_search_text);
- opts_argv = g_strsplit(opts, " ", -1);
- opts_argv_len = g_strv_length(opts_argv);
-
/* set grep command and options */
argv_prefix = g_new0(gchar*, 1 + opts_argv_len + 3 + 1); /* last +1 for recursive arg */
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).