about summary refs log tree commit diff stats
path: root/src/command/cmd_ac.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/command/cmd_ac.c')
-rw-r--r--src/command/cmd_ac.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 85800f99..e0d5f577 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -54,6 +54,7 @@
 #include "xmpp/muc.h"
 #include "xmpp/xmpp.h"
 #include "xmpp/roster_list.h"
+#include "ui/buffer.h"
 
 #ifdef HAVE_LIBGPGME
 #include "pgp/gpg.h"
@@ -122,6 +123,8 @@ static char* _avatar_autocomplete(ProfWin *window, const char *const input, gboo
 static char* _correction_autocomplete(ProfWin *window, const char *const input, gboolean previous);
 static char* _correct_autocomplete(ProfWin *window, const char *const input, gboolean previous);
 static char* _software_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _urlopen_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _executable_autocomplete(ProfWin *window, const char *const input, gboolean previous);
 
 static char* _script_autocomplete_func(const char *const prefix, gboolean previous, void *context);
 
@@ -254,6 +257,7 @@ static Autocomplete logging_group_ac;
 static Autocomplete color_ac;
 static Autocomplete correction_ac;
 static Autocomplete avatar_ac;
+static Autocomplete executable_ac;
 
 void
 cmd_ac_init(void)
@@ -986,8 +990,11 @@ cmd_ac_init(void)
 
     avatar_ac = autocomplete_new();
     autocomplete_add(avatar_ac, "get");
-    autocomplete_add(avatar_ac, "cmd");
     autocomplete_add(avatar_ac, "open");
+
+    executable_ac = autocomplete_new();
+    autocomplete_add(executable_ac, "avatar");
+    autocomplete_add(executable_ac, "urlopen");
 }
 
 void
@@ -1304,6 +1311,7 @@ cmd_ac_reset(ProfWin *window)
     autocomplete_reset(color_ac);
     autocomplete_reset(correction_ac);
     autocomplete_reset(avatar_ac);
+    autocomplete_reset(executable_ac);
 
     autocomplete_reset(script_ac);
     if (script_show_ac) {
@@ -1462,6 +1470,7 @@ cmd_ac_uninit(void)
     autocomplete_free(color_ac);
     autocomplete_free(correction_ac);
     autocomplete_free(avatar_ac);
+    autocomplete_free(executable_ac);
 }
 
 static void
@@ -1721,6 +1730,8 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input, gboolean previ
     g_hash_table_insert(ac_funcs, "/correction",    _correction_autocomplete);
     g_hash_table_insert(ac_funcs, "/correct",       _correct_autocomplete);
     g_hash_table_insert(ac_funcs, "/software",      _software_autocomplete);
+    g_hash_table_insert(ac_funcs, "/urlopen",       _urlopen_autocomplete);
+    g_hash_table_insert(ac_funcs, "/executable",    _executable_autocomplete);
 
     int len = strlen(input);
     char parsed[len+1];
@@ -3912,3 +3923,30 @@ _software_autocomplete(ProfWin *window, const char *const input, gboolean previo
 
 	return result;
 }
+
+static char*
+_urlopen_autocomplete(ProfWin *window, const char *const input, gboolean previous)
+{
+    char *result = NULL;
+
+	if (window->type == WIN_CHAT ||
+        window->type == WIN_MUC ||
+        window->type == WIN_PRIVATE) {
+        result = autocomplete_param_with_func(input, "/urlopen", wins_get_url, previous, window);
+    }
+
+    return result;
+}
+
+static char*
+_executable_autocomplete(ProfWin *window, const char *const input, gboolean previous)
+{
+    char *result = NULL;
+
+    result = autocomplete_param_with_ac(input, "/executable", executable_ac, TRUE, previous);
+    if (result) {
+        return result;
+    }
+
+    return NULL;
+}
vious revision' href='/akspecs/ranger/blame/doc/pydoc/ranger.ext.openstruct.html?h=v1.9.0b5&id=cc813408772738fc124130095ba4a5c33c84dea3'>^
f07bb12f ^








62cd83ba ^











































































f07bb12f ^

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144