[gnome-builder] vim: tweak priority of commands
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] vim: tweak priority of commands
- Date: Thu, 15 Aug 2019 22:27:32 +0000 (UTC)
commit 8403dccc885ff1428fb1c610dcd3da8e68230e31
Author: Christian Hergert <chergert redhat com>
Date: Thu Aug 15 23:27:15 2019 +0100
vim: tweak priority of commands
Fixes #1003
src/plugins/vim/gbp-vim-command.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/src/plugins/vim/gbp-vim-command.c b/src/plugins/vim/gbp-vim-command.c
index 5fb01cbe0..b68f02c98 100644
--- a/src/plugins/vim/gbp-vim-command.c
+++ b/src/plugins/vim/gbp-vim-command.c
@@ -23,6 +23,7 @@
#include "config.h"
#include <libide-gui.h>
+#include <libide-sourceview.h>
#include "gbp-vim-command.h"
#include "gb-vim.h"
@@ -34,8 +35,15 @@ struct _GbpVimCommand
gchar *typed_text;
gchar *command;
gchar *description;
+ gint priority;
};
+static gint
+gbp_vim_command_get_priority (IdeCommand *command)
+{
+ return GBP_VIM_COMMAND (command)->priority;
+}
+
static gchar *
gbp_vim_command_get_title (IdeCommand *command)
{
@@ -92,6 +100,7 @@ command_iface_init (IdeCommandInterface *iface)
iface->get_subtitle = gbp_vim_command_get_subtitle;
iface->run_async = gbp_vim_command_run_async;
iface->run_finish = gbp_vim_command_run_finish;
+ iface->get_priority = gbp_vim_command_get_priority;
}
G_DEFINE_TYPE_WITH_CODE (GbpVimCommand, gbp_vim_command, IDE_TYPE_OBJECT,
@@ -130,6 +139,7 @@ gbp_vim_command_new (GtkWidget *active_widget,
const gchar *description)
{
g_autoptr(GbpVimCommand) ret = NULL;
+ guint priority = G_MAXINT;
ret = g_object_new (GBP_TYPE_VIM_COMMAND, NULL);
ret->active_widget = g_object_ref (active_widget);
@@ -137,5 +147,8 @@ gbp_vim_command_new (GtkWidget *active_widget,
ret->command = g_strdup (command);
ret->description = g_strdup (description);
+ ide_completion_fuzzy_match (command, typed_text, &priority);
+ ret->priority = priority;
+
return g_steal_pointer (&ret);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]