Fix middle button pasting in the TextView (#81880, reported by Evert

Sat Mar 13 02:55:51 2004  Matthias Clasen  <maclas@gmx.de>

	Fix middle button pasting in the TextView  (#81880, reported
	by Evert Verhellen, patch by Paolo Borelli):

	* gtk/gtktextview.c (gtk_text_view_button_press_event): Retrieve
	the insert mark and move the cursor to it making sure of also
	scroll the window if needed.

	* gtk/gtktextbuffer.c (pre_paste_prep): Move the insert mark
	to the insertion point.
This commit is contained in:
Matthias Clasen 2004-03-13 01:54:04 +00:00 committed by Matthias Clasen
parent 3186b9e76b
commit fff3885193
7 changed files with 78 additions and 3 deletions

View File

@ -1,3 +1,15 @@
Sat Mar 13 02:55:51 2004 Matthias Clasen <maclas@gmx.de>
Fix middle button pasting in the TextView (#81880, reported
by Evert Verhellen, patch by Paolo Borelli):
* gtk/gtktextview.c (gtk_text_view_button_press_event): Retrieve
the insert mark and move the cursor to it making sure of also
scroll the window if needed.
* gtk/gtktextbuffer.c (pre_paste_prep): Move the insert mark
to the insertion point.
Sat Mar 13 01:38:55 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcombobox.c (gtk_combo_box_remove): Add a remove

View File

@ -1,3 +1,15 @@
Sat Mar 13 02:55:51 2004 Matthias Clasen <maclas@gmx.de>
Fix middle button pasting in the TextView (#81880, reported
by Evert Verhellen, patch by Paolo Borelli):
* gtk/gtktextview.c (gtk_text_view_button_press_event): Retrieve
the insert mark and move the cursor to it making sure of also
scroll the window if needed.
* gtk/gtktextbuffer.c (pre_paste_prep): Move the insert mark
to the insertion point.
Sat Mar 13 01:38:55 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcombobox.c (gtk_combo_box_remove): Add a remove

View File

@ -1,3 +1,15 @@
Sat Mar 13 02:55:51 2004 Matthias Clasen <maclas@gmx.de>
Fix middle button pasting in the TextView (#81880, reported
by Evert Verhellen, patch by Paolo Borelli):
* gtk/gtktextview.c (gtk_text_view_button_press_event): Retrieve
the insert mark and move the cursor to it making sure of also
scroll the window if needed.
* gtk/gtktextbuffer.c (pre_paste_prep): Move the insert mark
to the insertion point.
Sat Mar 13 01:38:55 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcombobox.c (gtk_combo_box_remove): Add a remove

View File

@ -1,3 +1,15 @@
Sat Mar 13 02:55:51 2004 Matthias Clasen <maclas@gmx.de>
Fix middle button pasting in the TextView (#81880, reported
by Evert Verhellen, patch by Paolo Borelli):
* gtk/gtktextview.c (gtk_text_view_button_press_event): Retrieve
the insert mark and move the cursor to it making sure of also
scroll the window if needed.
* gtk/gtktextbuffer.c (pre_paste_prep): Move the insert mark
to the insertion point.
Sat Mar 13 01:38:55 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcombobox.c (gtk_combo_box_remove): Add a remove

View File

@ -1,3 +1,15 @@
Sat Mar 13 02:55:51 2004 Matthias Clasen <maclas@gmx.de>
Fix middle button pasting in the TextView (#81880, reported
by Evert Verhellen, patch by Paolo Borelli):
* gtk/gtktextview.c (gtk_text_view_button_press_event): Retrieve
the insert mark and move the cursor to it making sure of also
scroll the window if needed.
* gtk/gtktextbuffer.c (pre_paste_prep): Move the insert mark
to the insertion point.
Sat Mar 13 01:38:55 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcombobox.c (gtk_combo_box_remove): Add a remove

View File

@ -2936,6 +2936,8 @@ pre_paste_prep (ClipboardRequest *request_data,
if (gtk_text_buffer_get_selection_bounds (buffer, &start, &end))
*insert_point = start;
}
gtk_text_buffer_move_mark_by_name (buffer, "insert", insert_point);
}
static void

View File

@ -3931,6 +3931,7 @@ gtk_text_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
else if (event->button == 2)
{
GtkTextIter iter;
GtkTextMark *mark;
gtk_text_layout_get_iter_at_pixel (text_view->layout,
&iter,
@ -3938,9 +3939,21 @@ gtk_text_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
event->y + text_view->yoffset);
gtk_text_buffer_paste_clipboard (get_buffer (text_view),
gtk_widget_get_clipboard (widget, GDK_SELECTION_PRIMARY),
&iter,
text_view->editable);
gtk_widget_get_clipboard (widget, GDK_SELECTION_PRIMARY),
&iter,
text_view->editable);
mark = gtk_text_buffer_get_mark (get_buffer (text_view), "insert");
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view),
&iter,
mark);
gtk_text_buffer_place_cursor (get_buffer (text_view), &iter);
DV(g_print (G_STRLOC": scrolling onscreen\n"));
gtk_text_view_scroll_mark_onscreen (text_view,
gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"));
return TRUE;
}
else if (event->button == 3)