[gimp] Issue #1220 - Text tool has color from previous line...



commit 1a691f77e67cbe755c19d2085df5b143e79c748f
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Sat Nov 4 13:50:47 2017 +0100

    Issue #1220 - Text tool has color from previous line...
    
    ...when overwriting existing text
    
    gimp_text_tool_enter_text(): when replacing a selection, use the text
    properties from the text style editor for the entered text, otherwise
    the style of the text before the selection will be used.

 app/tools/gimptexttool-editor.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/app/tools/gimptexttool-editor.c b/app/tools/gimptexttool-editor.c
index b2d4c46ec6..d97b822615 100644
--- a/app/tools/gimptexttool-editor.c
+++ b/app/tools/gimptexttool-editor.c
@@ -1389,13 +1389,19 @@ static void
 gimp_text_tool_enter_text (GimpTextTool *text_tool,
                            const gchar  *str)
 {
-  GtkTextBuffer *buffer = GTK_TEXT_BUFFER (text_tool->buffer);
+  GtkTextBuffer *buffer      = GTK_TEXT_BUFFER (text_tool->buffer);
+  GList         *insert_tags = NULL;
+  GList         *remove_tags = NULL;
   gboolean       had_selection;
 
   had_selection = gtk_text_buffer_get_has_selection (buffer);
 
   gtk_text_buffer_begin_user_action (buffer);
 
+  if (had_selection && text_tool->style_editor)
+    insert_tags = gimp_text_style_editor_list_tags (GIMP_TEXT_STYLE_EDITOR (text_tool->style_editor),
+                                                    &remove_tags);
+
   gimp_text_tool_delete_selection (text_tool);
 
   if (! had_selection && text_tool->overwrite_mode && strcmp (str, "\n"))
@@ -1409,6 +1415,10 @@ gimp_text_tool_enter_text (GimpTextTool *text_tool,
         gimp_text_tool_delete_from_cursor (text_tool, GTK_DELETE_CHARS, 1);
     }
 
+  if (had_selection && text_tool->style_editor)
+    gimp_text_buffer_set_insert_tags (text_tool->buffer,
+                                      insert_tags, remove_tags);
+
   gimp_text_buffer_insert (text_tool->buffer, str);
 
   gtk_text_buffer_end_user_action (buffer);


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