about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2022-04-28 17:54:12 +0200
committerMichael Vetter <jubalh@iodoru.org>2022-04-28 17:54:12 +0200
commit69663b83c8dd5b494e0dc6554507ab53ef0c18b9 (patch)
tree64b47592025147e3b499dfa87d58f866cbd3b3ff
parent9fcd589682e91aee8ec594957bc8c2dcb4dd79f2 (diff)
downloadprofani-tty-69663b83c8dd5b494e0dc6554507ab53ef0c18b9.tar.gz
Fix ox autocompletion
Sometimes this happened:
 `ox d<tab>` → `/ox request`
 `ox a<tab>` → `/ox request`
 `ox c<tab>` → `/ox keys`
 `ox s<tab>` → `/ox keys`
 `ox e<tab>` → `/ox keys`

We didn't reset the ox_*_ac variables.
-rw-r--r--src/command/cmd_ac.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 1f6246a4..6c8ddf50 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -1436,6 +1436,7 @@ cmd_ac_reset(ProfWin* window)
     autocomplete_reset(pgp_ac);
     autocomplete_reset(pgp_log_ac);
     autocomplete_reset(pgp_sendfile_ac);
+    autocomplete_reset(ox_ac);
 #endif
     autocomplete_reset(tls_ac);
     autocomplete_reset(titlebar_ac);
@@ -1597,6 +1598,9 @@ cmd_ac_uninit(void)
     autocomplete_free(pgp_ac);
     autocomplete_free(pgp_log_ac);
     autocomplete_free(pgp_sendfile_ac);
+    autocomplete_free(ox_ac);
+    autocomplete_free(ox_log_ac);
+    autocomplete_free(ox_sendfile_ac);
 #endif
     autocomplete_free(tls_ac);
     autocomplete_free(titlebar_ac);
@@ -2568,6 +2572,11 @@ _ox_autocomplete(ProfWin* window, const char* const input, gboolean previous)
 {
     char* found = NULL;
 
+    found = autocomplete_param_with_ac(input, "/ox", ox_ac, TRUE, previous);
+    if (found) {
+        return found;
+    }
+
     jabber_conn_status_t conn_status = connection_get_status();
 
     if (conn_status == JABBER_CONNECTED) {
@@ -2601,9 +2610,7 @@ _ox_autocomplete(ProfWin* window, const char* const input, gboolean previous)
         return cmd_ac_complete_filepath(input, "/ox announce", previous);
     }
 
-    found = autocomplete_param_with_ac(input, "/ox", ox_ac, TRUE, previous);
-
-    return found;
+    return NULL;
 }
 #endif
 
'#n181'>181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321