This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efm2.
View the commit online.
commit 60c41c1ac1668e77af0f488ea11a28af87b68694
Author: Carsten Haitzler (Rasterman) <[email protected]>
AuthorDate: Sun Feb 8 13:13:47 2026 +0000
improve backend arg completion code
---
src/backends/default/open.c | 92 ++++++++++++++++++++++-----------------------
1 file changed, 44 insertions(+), 48 deletions(-)
diff --git a/src/backends/default/open.c b/src/backends/default/open.c
index 4f69e4d..5d915da 100644
--- a/src/backends/default/open.c
+++ b/src/backends/default/open.c
@@ -1378,62 +1378,60 @@ done:
eina_strbuf_free(strbuf);
}
+static char *
+_complete_arg_path(char *arg)
+{
+ Eina_Strbuf *buf = eina_strbuf_new();
+ char *comp = NULL;
+ const char *mondir = ecore_file_monitor_path_get(mon);
+
+ if (!buf) return NULL;
+ if (!mondir) goto done;
+ if (!strncmp(arg, "../", 3))
+ { // ../relatve/path.xx
+ char *tmps = ecore_file_dir_get(mondir);
+
+ if (tmps)
+ {
+ eina_strbuf_append_printf(buf, "%s/%s", tmps, arg + 3);
+ comp = util_complete(eina_strbuf_string_get(buf), COMPLETE_ANY);
+ free(tmps);
+ }
+ }
+ else if (arg[0] == '/')
+ { // /full/path/arg.xx
+ eina_strbuf_append(buf, arg);
+ comp = util_complete(eina_strbuf_string_get(buf), COMPLETE_ANY);
+ }
+ else
+ { // flename/path/blah.xx
+ const char *append = arg;
+
+ if (!strncmp(arg, "./", 2)) append += 2;
+ eina_strbuf_append_printf(buf, "%s/%s", mondir, append);
+ comp = util_complete(eina_strbuf_string_get(buf), COMPLETE_ANY);
+ }
+done:
+ if (buf) eina_strbuf_free(buf);
+ return comp;
+}
+
static Eina_Bool
_complete_last_arg_path_cmd(char **args, Eina_Strbuf *cmd, const char *cmd_arg)
{
Eina_Strbuf *buf = eina_strbuf_new();
- Eina_Bool ret = EINA_FALSE;
- int i;
+ Eina_Bool ret = EINA_FALSE;
+ int i;
- fprintf(stderr, "GGG: complete cd args\n");
if (!buf) return ret;
for (i = 0; args[i]; i++)
{
- if (args[i + 1])
- { // other args - just append them
- eina_strbuf_append(buf, args[i]);
- eina_strbuf_append(buf, " ");
- }
+ if (args[i + 1]) // other args - just append them
+ eina_strbuf_append_printf(buf, "%s ", args[i]);
else
{ // last arg
- Eina_Strbuf *buf2 = eina_strbuf_new();
- const char *mondir;
- char *tmps, *comp = NULL;
-
- mondir = ecore_file_monitor_path_get(mon);
- if (!strncmp(args[i], "../", 3))
- {
- tmps = ecore_file_dir_get(mondir);
- if (tmps)
- {
- fprintf(stderr, "GGG: parent[%s]\n", tmps);
- eina_strbuf_append(buf2, tmps);
- eina_strbuf_append(buf2, "/");
- eina_strbuf_append(buf2, args[i] + 3);
- fprintf(stderr, "GGG: input[%s]\n",
- eina_strbuf_string_get(buf2));
- comp
- = util_complete(eina_strbuf_string_get(buf2), COMPLETE_ANY);
- free(tmps);
- }
- }
- else if (args[i][0] == '/')
- {
- eina_strbuf_append(buf2, args[i]);
- fprintf(stderr, "GGG: input[%s]\n", eina_strbuf_string_get(buf2));
- comp = util_complete(eina_strbuf_string_get(buf2), COMPLETE_ANY);
- }
- else
- {
- eina_strbuf_append(buf2, mondir);
- eina_strbuf_append(buf2, "/");
- if (!strncmp(args[i], "./", 2))
- eina_strbuf_append(buf2, args[i] + 2);
- else eina_strbuf_append(buf2, args[i]);
- fprintf(stderr, "GGG: input[%s]\n", eina_strbuf_string_get(buf2));
- comp = util_complete(eina_strbuf_string_get(buf2), COMPLETE_ANY);
- }
- fprintf(stderr, "GGG: comp=[%s]\n", comp);
+ char *comp = _complete_arg_path(args[i]);
+
if (comp)
{
eina_strbuf_append(buf, comp);
@@ -1441,11 +1439,9 @@ _complete_last_arg_path_cmd(char **args, Eina_Strbuf *cmd, const char *cmd_arg)
ret = EINA_TRUE;
}
else eina_strbuf_append(buf, args[i]);
- eina_strbuf_free(buf2);
}
}
cmd_strbuf_append(cmd, cmd_arg, eina_strbuf_string_get(buf));
- fprintf(stderr, "GGG: set typebuf [%s]\n", eina_strbuf_string_get(buf));
eina_strbuf_free(buf);
return ret;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.