Bug 675748: Text tool: text editor inhibits text...

...selection on the canvas

if the editor dialog is active do not copy to the
clipboard the text selected, copy it instead when
selected with keys <Shift>-left/right.
This commit is contained in:
Massimo Valentini 2016-07-16 16:28:35 +02:00
parent 3a75d98679
commit aa293ae9a7
1 changed files with 24 additions and 13 deletions

View File

@ -115,6 +115,9 @@ static gboolean gimp_text_tool_im_delete_surrounding
static void gimp_text_tool_im_delete_preedit (GimpTextTool *text_tool);
static void gimp_text_tool_editor_copy_selection_to_clipboard
(GimpTextTool *text_tool);
/* public functions */
@ -344,19 +347,7 @@ gimp_text_tool_editor_button_press (GimpTextTool *text_tool,
void
gimp_text_tool_editor_button_release (GimpTextTool *text_tool)
{
GtkTextBuffer *buffer = GTK_TEXT_BUFFER (text_tool->buffer);
if (gtk_text_buffer_get_has_selection (buffer))
{
GimpTool *tool = GIMP_TOOL (text_tool);
GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
GtkClipboard *clipboard;
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell),
GDK_SELECTION_PRIMARY);
gtk_text_buffer_copy_clipboard (buffer, clipboard);
}
gimp_text_tool_editor_copy_selection_to_clipboard (text_tool);
}
void
@ -995,6 +986,7 @@ gimp_text_tool_move_cursor (GimpTextTool *text_tool,
gimp_text_tool_reset_im_context (text_tool);
gtk_text_buffer_select_range (buffer, &cursor, sel_start);
gimp_text_tool_editor_copy_selection_to_clipboard (text_tool);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
}
@ -1651,3 +1643,22 @@ gimp_text_tool_im_delete_preedit (GimpTextTool *text_tool)
text_tool->preedit_string = NULL;
}
}
static void
gimp_text_tool_editor_copy_selection_to_clipboard (GimpTextTool *text_tool)
{
GtkTextBuffer *buffer = GTK_TEXT_BUFFER (text_tool->buffer);
if (! text_tool->editor_dialog &&
gtk_text_buffer_get_has_selection (buffer))
{
GimpTool *tool = GIMP_TOOL (text_tool);
GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
GtkClipboard *clipboard;
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell),
GDK_SELECTION_PRIMARY);
gtk_text_buffer_copy_clipboard (buffer, clipboard);
}
}