[evolution] EHTMLEditorView - Only stop propagating the key press event when we moved to different table cell



commit b5419e97d8910c36cfdce6242734df48dc1b6ac3
Author: Tomas Popela <tpopela redhat com>
Date:   Tue Mar 10 14:42:12 2015 +0100

    EHTMLEditorView - Only stop propagating the key press event when we moved to different table cell

 e-util/e-html-editor-view.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 2c29c5c..fe33a4a 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -3171,7 +3171,7 @@ selection_is_in_table (WebKitDOMDocument *document,
        return *table_node != NULL;
 }
 
-static void
+static gboolean
 jump_to_next_table_cell (EHTMLEditorView *view,
                          gboolean jump_back)
 {
@@ -3186,7 +3186,7 @@ jump_to_next_table_cell (EHTMLEditorView *view,
        selection = webkit_dom_dom_window_get_selection (window);
 
        if (webkit_dom_dom_selection_get_range_count (selection) < 1)
-               return;
+               return FALSE;
 
        range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
        node = webkit_dom_range_get_start_container (range, NULL);
@@ -3197,7 +3197,7 @@ jump_to_next_table_cell (EHTMLEditorView *view,
        }
 
        if (!WEBKIT_DOM_IS_HTML_TABLE_CELL_ELEMENT (cell))
-               return;
+               return FALSE;
 
        if (jump_back) {
                /* Get previous cell */
@@ -3238,12 +3238,14 @@ jump_to_next_table_cell (EHTMLEditorView *view,
        }
 
        if (!node)
-               return;
+               return FALSE;
 
        webkit_dom_range_select_node_contents (range, node, NULL);
        webkit_dom_range_collapse (range, TRUE, NULL);
        webkit_dom_dom_selection_remove_all_ranges (selection);
        webkit_dom_dom_selection_add_range (selection, range);
+
+       return TRUE;
 }
 
 static gboolean
@@ -3273,10 +3275,11 @@ html_editor_view_key_press_event (GtkWidget *widget,
                WebKitDOMDocument *document;
 
                document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
-               if (selection_is_in_table (document, NULL, NULL)) {
-                       jump_to_next_table_cell (view, event->keyval == GDK_KEY_ISO_Left_Tab);
-                       return TRUE;
-               } else if (event->keyval == GDK_KEY_Tab)
+               if (selection_is_in_table (document, NULL, NULL))
+                       if (jump_to_next_table_cell (view, event->keyval == GDK_KEY_ISO_Left_Tab))
+                               return TRUE;
+
+               if (event->keyval == GDK_KEY_Tab)
                        return e_html_editor_view_exec_command (
                                view, E_HTML_EDITOR_VIEW_COMMAND_INSERT_TEXT, "\t");
                else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]