[evolution] EHTMLEditorSelection - Dash is a valid character for wrapping only if it's not surrounded by spaces



commit 04dcebf465884a421eead9d20ee2d7f9e5d13208
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Sep 7 16:41:21 2015 +0200

    EHTMLEditorSelection - Dash is a valid character for wrapping only if it's not surrounded by spaces

 e-util/e-html-editor-selection.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index c0321bb..5552f95 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -6128,8 +6128,27 @@ find_where_to_break_line (WebKitDOMCharacterData *node,
                }
 
                if (g_unichar_isspace (uc) || *str == '-') {
-                       last_break_position_is_dash = *str == '-';
-                       last_break_position = pos;
+                       if ((last_break_position_is_dash = *str == '-')) {
+                               /* There was no space before the dash */
+                               if (pos - 1 != last_break_position) {
+                                       gchar *rest;
+
+                                       rest = g_utf8_next_char (str);
+                                       if (rest && *rest) {
+                                               gunichar next_char;
+
+                                               /* There is no space after the dash */
+                                               next_char = g_utf8_get_char (rest);
+                                               if (g_unichar_isspace (next_char))
+                                                       last_break_position_is_dash = FALSE;
+                                               else
+                                                       last_break_position = pos;
+                                       } else
+                                               last_break_position_is_dash = FALSE;
+                               } else
+                                       last_break_position_is_dash = FALSE;
+                       } else
+                               last_break_position = pos;
                }
 
                if ((pos == max_length)) {


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