diff options
| -rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
| -rwxr-xr-x | gtk/ScintillaGTK.cxx | 11 | ||||
| -rwxr-xr-x | gtk/ScintillaGTK.h | 1 | 
3 files changed, 13 insertions, 3 deletions
| diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index b4b7c6a56..912a3ffeb 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -581,6 +581,10 @@  	Add CARETSTYLE_CURSES to draw more than 1 caret on curses terminal.  	</li>  	<li> +	On GTK, fix primary selection paste within same instance. +	<a href="https://sourceforge.net/p/scintilla/bugs/2287/">Bug #2287</a>. +	</li> +	<li>  	On GTK, fix potential crash when closing Scintilla instances due to releasing global settings object.  	</li>  	<li> diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index c64e2dca9..8a188d769 100755 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -1563,8 +1563,8 @@ void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, Selectio  void ScintillaGTK::InsertSelection(GtkClipboard *clipBoard, GtkSelectionData *selectionData) {  	const gint length = gtk_selection_data_get_length(selectionData); +	const GdkAtom selection = gtk_selection_data_get_selection(selectionData);  	if (length >= 0) { -		GdkAtom selection = gtk_selection_data_get_selection(selectionData);  		SelectionText selText;  		GetGtkSelectionText(selectionData, selText); @@ -1572,11 +1572,17 @@ void ScintillaGTK::InsertSelection(GtkClipboard *clipBoard, GtkSelectionData *se  		if (selection == GDK_SELECTION_CLIPBOARD) {  			ClearSelection(multiPasteMode == MultiPaste::Each);  		} +		if (selection == GDK_SELECTION_PRIMARY) { +			SetSelection(posPrimary, posPrimary); +		}  		InsertPasteShape(selText.Data(), selText.Length(),  				 selText.rectangular ? PasteShape::rectangular : PasteShape::stream);  		EnsureCaretVisible();  	} else { +		if (selection == GDK_SELECTION_PRIMARY) { +			SetSelection(posPrimary, posPrimary); +		}  		GdkAtom target = gtk_selection_data_get_target(selectionData);  		if (target == atomUTF8) {  			// In case data is actually only stored as text/plain;charset=utf-8 not UTF8_STRING @@ -1877,12 +1883,11 @@ gint ScintillaGTK::PressThis(GdkEventButton *event) {  			ButtonDownWithModifiers(pt, event->time, ModifierFlags(shift, ctrl, alt, meta));  		} else if (event->button == 2) {  			// Grab the primary selection if it exists -			const SelectionPosition pos = SPositionFromLocation(pt, false, false, UserVirtualSpace()); +			posPrimary = SPositionFromLocation(pt, false, false, UserVirtualSpace());  			if (OwnPrimarySelection() && primary.Empty())  				CopySelectionRange(&primary);  			sel.Clear(); -			SetSelection(pos, pos);  			RequestSelection(GDK_SELECTION_PRIMARY);  		} else if (event->button == 3) {  			if (!PointInSelection(pt)) diff --git a/gtk/ScintillaGTK.h b/gtk/ScintillaGTK.h index 8d9f41e6b..36e6a78a8 100755 --- a/gtk/ScintillaGTK.h +++ b/gtk/ScintillaGTK.h @@ -34,6 +34,7 @@ class ScintillaGTK : public ScintillaBase {  	int horizontalScrollBarHeight;  	SelectionText primary; +	SelectionPosition posPrimary;  	GdkEvent *evbtn;  	guint buttonMouse; | 
