From e9f85b3afcb92e3e4dc25391b4c52d03c7771eaf Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Fri, 5 Mar 2010 10:53:09 +0100 Subject: [PATCH] app: block text buffer signals around copying to the clipboard so the copying doesn't produce an undo step. Same fix as applied earlier in button_press(). --- app/tools/gimptexttool.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c index 3c4a4caee7..5fddfe8abc 100644 --- a/app/tools/gimptexttool.c +++ b/app/tools/gimptexttool.c @@ -1804,8 +1804,27 @@ gimp_text_tool_copy_clipboard (GimpTextTool *text_tool) clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell), GDK_SELECTION_CLIPBOARD); + /* need to block "end-user-action" on the text buffer, because + * GtkTextBuffer considers copying text to the clipboard an + * undo-relevant user action, which is clearly a bug, but what + * can we do... + */ + g_signal_handlers_block_by_func (text_tool->buffer, + gimp_text_tool_buffer_begin_edit, + text_tool); + g_signal_handlers_block_by_func (text_tool->buffer, + gimp_text_tool_buffer_end_edit, + text_tool); + gtk_text_buffer_copy_clipboard (GTK_TEXT_BUFFER (text_tool->buffer), clipboard); + + g_signal_handlers_unblock_by_func (text_tool->buffer, + gimp_text_tool_buffer_end_edit, + text_tool); + g_signal_handlers_unblock_by_func (text_tool->buffer, + gimp_text_tool_buffer_begin_edit, + text_tool); } void