[geany/geany] d4a359: Fix snippets keybindings not blocking handled events

Colomban Wendling git-noreply at xxxxx
Mon Jan 9 13:42:20 UTC 2017


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 09 Jan 2017 13:42:20 UTC
Commit:      d4a35947d31fa1c150d90e3fd1cc6b060baed9a3
             https://github.com/geany/geany/commit/d4a35947d31fa1c150d90e3fd1cc6b060baed9a3

Log Message:
-----------
Fix snippets keybindings not blocking handled events

Fix signature of the snippets keybindings callback, properly blocking
further propagation of handled events thus avoiding possibly activating
another action (like a builtin Scintilla keybinding).

Fixes #1354.


Modified Paths:
--------------
    src/editor.c

Modified: src/editor.c
8 lines changed, 5 insertions(+), 3 deletions(-)
===================================================================
@@ -191,13 +191,13 @@ static void snippets_load(GKeyFile *sysconfig, GKeyFile *userconfig)
 }
 
 
-static void on_snippet_keybinding_activate(gchar *key)
+static gboolean on_snippet_keybinding_activate(gchar *key)
 {
 	GeanyDocument *doc = document_get_current();
 	const gchar *s;
 
 	if (!doc || !gtk_widget_has_focus(GTK_WIDGET(doc->editor->sci)))
-		return;
+		return FALSE;
 
 	s = snippets_find_completion_by_name(doc->file_type->name, key);
 	if (!s) /* allow user to specify keybindings for "special" snippets */
@@ -210,11 +210,13 @@ static void on_snippet_keybinding_activate(gchar *key)
 	if (!s)
 	{
 		utils_beep();
-		return;
+		return FALSE;
 	}
 
 	editor_insert_snippet(doc->editor, sci_get_current_position(doc->editor->sci), s);
 	sci_scroll_caret(doc->editor->sci);
+
+	return TRUE;
 }
 
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list