[evolution] EHTMLEditorSelection - Limit the paragraph minimal width to 5 characters



commit 45fa23472760037a94f00873538da91b1ae65b7f
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Aug 7 11:32:08 2014 +0200

    EHTMLEditorSelection - Limit the paragraph minimal width to 5 characters

 e-util/e-html-editor-selection.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index 47aeecf..86f96ce 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -44,6 +44,7 @@
 
 #define SPACES_PER_INDENTATION 4
 #define SPACES_PER_LIST_LEVEL 8
+#define MINIMAL_PARAGRAPH_WIDTH 5
 
 /**
  * EHTMLEditorSelection
@@ -2841,7 +2842,8 @@ e_html_editor_selection_indent (EHTMLEditorSelection *selection)
                        level = get_indentation_level (WEBKIT_DOM_ELEMENT (block));
 
                        final_width = word_wrap_length - SPACES_PER_INDENTATION * (level + 1);
-                       if (final_width < 10 && !is_in_html_mode (selection)) {
+                       if (final_width < MINIMAL_PARAGRAPH_WIDTH &&
+                           !is_in_html_mode (selection)) {
                                if (!after_selection_end) {
                                        block = next_block;
                                        continue;
@@ -2875,7 +2877,8 @@ e_html_editor_selection_indent (EHTMLEditorSelection *selection)
                                WEBKIT_DOM_ELEMENT (block_to_process));
 
                        final_width = word_wrap_length - SPACES_PER_INDENTATION * (level + 1);
-                       if (final_width < 10 && !is_in_html_mode (selection))
+                       if (final_width < MINIMAL_PARAGRAPH_WIDTH &&
+                           !is_in_html_mode (selection))
                                continue;
 
                        indent_block (selection, document, block_to_process, final_width);
@@ -5668,7 +5671,7 @@ e_html_editor_selection_wrap_paragraph_length (EHTMLEditorSelection *selection,
 
        g_return_val_if_fail (E_IS_HTML_EDITOR_SELECTION (selection), NULL);
        g_return_val_if_fail (WEBKIT_DOM_IS_ELEMENT (paragraph), NULL);
-       g_return_val_if_fail (length > 10, NULL);
+       g_return_val_if_fail (length >= MINIMAL_PARAGRAPH_WIDTH, NULL);
 
        document = webkit_dom_node_get_owner_document (WEBKIT_DOM_NODE (paragraph));
 


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