Added completion for shortcuts.
authorDaniel Carl <danielcarl@gmx.de>
Thu, 2 Mar 2017 00:10:12 +0000 (01:10 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Thu, 2 Mar 2017 00:10:12 +0000 (01:10 +0100)
Completion for shortcuts are now available for :shortcut-remove and
:shortcut-default.

src/ex.c
src/shortcut.c
src/shortcut.h

index eaa97cb..cc4bdbe 100644 (file)
--- a/src/ex.c
+++ b/src/ex.c
@@ -1179,8 +1179,9 @@ static gboolean complete(Client *c, short direction)
                     found = bookmark_fill_tag_completion(store, token);
                     break;
 
-                case EX_SCR:
-                    /* TODO fill shortcut completion */
+                case EX_SCR: /* Fallthrough */
+                case EX_SCD:
+                    found = shortcut_fill_completion(c, store, token);
                     break;
 
                 case EX_HANDREM:
index 7545037..af858ab 100644 (file)
@@ -157,8 +157,7 @@ char *shortcut_get_uri(Client *c, const char *string)
     return uri;
 }
 
-#if 0
-gboolean shortcut_fill_completion(GtkListStore *store, const char *input)
+gboolean shortcut_fill_completion(Client *c, GtkListStore *store, const char *input)
 {
     GList *src = g_hash_table_get_keys(c->shortcut.table);
     gboolean found = util_fill_completion(store, input, src);
@@ -166,7 +165,6 @@ gboolean shortcut_fill_completion(GtkListStore *store, const char *input)
 
     return found;
 }
-#endif
 
 /**
  * Retrieves th highest placeholder number used in given string.
index 9b44e29..21e21ff 100644 (file)
@@ -26,7 +26,7 @@ gboolean shortcut_add(Client *c, const char *key, const char *uri);
 gboolean shortcut_remove(Client *c, const char *key);
 gboolean shortcut_set_default(Client *c, const char *key);
 char *shortcut_get_uri(Client *c, const char *key);
-/*gboolean shortcut_fill_completion(Client *c, GtkListStore *store, const char *input);*/
+gboolean shortcut_fill_completion(Client *c, GtkListStore *store, const char *input);
 
 #endif /* end of include guard: _SHORTCUT_H */