about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2023-01-02 15:09:20 +0100
committerGitHub <noreply@github.com>2023-01-02 15:09:20 +0100
commitc5c33bdce1e79e2006916859b899b73da97ede3c (patch)
tree328910575c26f590e5a759c28538438a6cffb327
parent9645e799aca1a3b74435460fb4e212d9e2a82a60 (diff)
parent525ec11e4619409a95f8506dd2bf9a2724f69d37 (diff)
downloadprofani-tty-c5c33bdce1e79e2006916859b899b73da97ede3c.tar.gz
Merge pull request #1784 from MarcoPolo-PasTonMolo/fix/1783-url-save-ac-filenames
Make `/url save` autocomplete filenames after a url
-rw-r--r--src/command/cmd_ac.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 9a839258..4fc2e63d 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -4352,7 +4352,21 @@ _url_autocomplete(ProfWin* window, const char* const input, gboolean previous)
             return result;
         }
 
-        result = autocomplete_param_with_func(input, "/url save", wins_get_url, previous, window);
+        gboolean arg_result;
+        gchar** args = parse_args(input, 1, 8, &arg_result);
+        gboolean space_at_end = g_str_has_suffix(input, " ");
+        int num_args = g_strv_length(args);
+
+        if (arg_result) {
+            if ((num_args == 1 && space_at_end) || (num_args == 2 && !space_at_end)) {
+                result = autocomplete_param_with_func(input, "/url save", wins_get_url, previous, window);
+            } else if ((num_args == 2 && space_at_end) || (num_args == 3 && !space_at_end)) {
+                gchar* cmd = g_strdup_printf("/url save %s", args[1]);
+                result = cmd_ac_complete_filepath(input, cmd, previous);
+                g_free(cmd);
+            }
+        }
+        g_strfreev(args);
     }
 
     return result;
-06-27 10:33:11 -0700 committer Drew DeVault <sir@cmpwn.com> 2019-06-29 14:24:19 -0400 Implement basic tab completion support' href='/akspecs/aerc/commit/commands/msgview/toggle-headers.go?h=0.5.2&id=2a0961701c4cabecc53d134ed1782e5612e64580'>2a09617 ^
b83e7c9 ^

6838c23 ^
b83e7c9 ^






2a09617 ^

feacca3 ^
2a09617 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34