[evolution/wip/webkit-composer: 730/966] Handle situations when Return is pressed in already wrapped paragraph.



commit a38021c571539d22ec9aa1844b9aaa9ac04f5a4a
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Jul 22 17:05:18 2013 +0200

    Handle situations when Return is pressed in already wrapped paragraph.

 e-util/e-editor-selection.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index 1458613..3f07aa8 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -3090,6 +3090,7 @@ e_editor_selection_wrap_lines (EEditorSelection *selection,
        gboolean adding = FALSE;
        gboolean backspace_pressed = FALSE;
        gboolean return_pressed = FALSE;
+       gboolean return_pressed_in_text = FALSE;
        gboolean delete_pressed = FALSE;
        gboolean jump_to_previous_line = FALSE;
        gboolean previously_wrapped = FALSE;
@@ -3215,6 +3216,10 @@ e_editor_selection_wrap_lines (EEditorSelection *selection,
                        /* If we are on the beginning of line we need to remember it */
                        if (!adding && start_offset > selection->priv->word_wrap_length)
                                jump_to_previous_line = TRUE;
+
+                       if (return_pressed)
+                               return_pressed_in_text = TRUE;
+
                } else {
                        WebKitDOMElement *caret_position;
                        gboolean parent_is_body = FALSE;
@@ -3247,6 +3252,8 @@ e_editor_selection_wrap_lines (EEditorSelection *selection,
 
                                        if (WEBKIT_DOM_IS_ELEMENT (next_sibling))
                                                move_caret_into_element (document, WEBKIT_DOM_ELEMENT 
(next_sibling));
+                                       else
+                                               move_caret_into_element (document, caret_position);
 
                                        e_editor_selection_clear_caret_position_marker (selection);
                                } else {
@@ -3315,15 +3322,12 @@ e_editor_selection_wrap_lines (EEditorSelection *selection,
 
        active_paragraph = webkit_dom_document_get_element_by_id (document, "-x-evo-active-paragraph");
        /* We have to move caret on position where it was before modifying the text */
-       if (return_pressed) {
+       if (return_pressed && !return_pressed_in_text) {
                e_editor_selection_clear_caret_position_marker (selection);
                move_caret_into_element (document, active_paragraph);
                webkit_dom_dom_selection_modify (window_selection, "move", "forward", "character");
        } else {
-               if (while_typing)
-                       e_editor_selection_restore_caret_position (selection);
-               else
-                       e_editor_selection_clear_caret_position_marker (selection);
+               e_editor_selection_restore_caret_position (selection);
        }
 
        /* Set paragraph as non-active */


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