Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Sun, 05 May 2019 16:59:38 UTC Commit: 81d8c20853fbbf0d210e17d4e2a8e655ea27dd50 https://github.com/geany/geany-plugins/commit/81d8c20853fbbf0d210e17d4e2a8e6...
Log Message: ----------- vimode: check modifiers in command mode
Modified Paths: -------------- vimode/src/excmd-prompt.c
Modified: vimode/src/excmd-prompt.c 99 lines changed, 52 insertions(+), 47 deletions(-) =================================================================== @@ -60,66 +60,71 @@ static void set_prompt_text(const gchar *val)
static gboolean on_prompt_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer dummy) { - switch (event->keyval) - { - case GDK_KEY_Escape: - close_prompt(); - return TRUE; - - case GDK_KEY_Tab: - /* avoid leaving the entry */ - return TRUE; + guint mask = GDK_MODIFIER_MASK & ~(GDK_SHIFT_MASK | GDK_LOCK_MASK);
- case GDK_KEY_Return: - case GDK_KEY_KP_Enter: - case GDK_KEY_ISO_Enter: + if ((event->state & mask) == 0) + { + switch (event->keyval) { - guint index; - const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry)); + case GDK_KEY_Escape: + close_prompt(); + return TRUE;
- if (g_ptr_array_find_with_equal_func(history, text + 1, g_str_equal, &index)) - g_ptr_array_remove_index(history, index); - if (strlen(text) > 1) - g_ptr_array_add(history, g_strdup(text + 1)); - if (history->len > 20) // default vim history size - g_ptr_array_remove_index(history, 0); + case GDK_KEY_Tab: + /* avoid leaving the entry */ + return TRUE;
- excmd_perform(ctx, text); - close_prompt(); + case GDK_KEY_Return: + case GDK_KEY_KP_Enter: + case GDK_KEY_ISO_Enter: + { + guint index; + const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry));
- return TRUE; - } + if (g_ptr_array_find_with_equal_func(history, text + 1, g_str_equal, &index)) + g_ptr_array_remove_index(history, index); + if (strlen(text) > 1) + g_ptr_array_add(history, g_strdup(text + 1)); + if (history->len > 20) // default vim history size + g_ptr_array_remove_index(history, 0);
- case GDK_KEY_Up: - case GDK_KEY_KP_Up: - case GDK_KEY_uparrow: - { - if (history_pos == -1 && history->len > 0) - history_pos = history->len - 1; - else if (history_pos > 0) - history_pos--; + excmd_perform(ctx, text); + close_prompt();
- if (history_pos != -1) - set_prompt_text(history->pdata[history_pos]); + return TRUE; + }
- return TRUE; - } + case GDK_KEY_Up: + case GDK_KEY_KP_Up: + case GDK_KEY_uparrow: + { + if (history_pos == -1 && history->len > 0) + history_pos = history->len - 1; + else if (history_pos > 0) + history_pos--; + + if (history_pos != -1) + set_prompt_text(history->pdata[history_pos]);
- case GDK_KEY_Down: - case GDK_KEY_KP_Down: - case GDK_KEY_downarrow: - { - if (history_pos == -1) return TRUE; + } + + case GDK_KEY_Down: + case GDK_KEY_KP_Down: + case GDK_KEY_downarrow: + { + if (history_pos == -1) + return TRUE;
- if (history_pos + 1 < history->len) - history_pos++; - else - history_pos = -1; + if (history_pos + 1 < history->len) + history_pos++; + else + history_pos = -1;
- set_prompt_text(history_pos == -1 ? "" : history->pdata[history_pos]); + set_prompt_text(history_pos == -1 ? "" : history->pdata[history_pos]);
- return TRUE; + return TRUE; + } } }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org