Skip to content

Commit 4d26225

Browse files
sc0wlukefromdc
authored andcommitted
pluma-view: Fix: Don't loss the PRIMARY clipboard
Fixes #179
1 parent 4a74dc6 commit 4d26225

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pluma/pluma-view.c

+12
Original file line numberDiff line numberDiff line change
@@ -2137,6 +2137,18 @@ show_line_numbers_menu (GtkWidget *view,
21372137
static gboolean
21382138
pluma_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
21392139
{
2140+
static gchar *primtxt = "";
2141+
2142+
gchar *txt_clip = gtk_clipboard_wait_for_text (gtk_clipboard_get (GDK_SELECTION_PRIMARY));
2143+
2144+
if (txt_clip)
2145+
{
2146+
primtxt = g_strdup (txt_clip);
2147+
g_free (txt_clip);
2148+
}
2149+
else
2150+
gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_PRIMARY), primtxt, strlen (primtxt));
2151+
21402152
if ((event->type == GDK_BUTTON_PRESS) &&
21412153
(event->window == gtk_text_view_get_window (GTK_TEXT_VIEW (widget),
21422154
GTK_TEXT_WINDOW_LEFT)))

0 commit comments

Comments
 (0)