summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorArnavion <arnavion@gmail.com>2015-02-20 02:54:41 -0800
committerArnavion <arnavion@gmail.com>2015-02-20 02:54:41 -0800
commite42da22716d3d95fcf71ed5f36b6f5e4a9c3627d (patch)
tree1942c70e2ef8427339f4dfcdd181908bdde553a9 /src
parent0a8248578fc9188adf4c983729e4cd775c4d52bd (diff)
Revert "xtext: Unselect old selection on button press" - breaks clicking URLs to open them.
This reverts commit 8ca96d7ea3ec0281802eb08174ca2fdcbcc8263f.
Diffstat (limited to 'src')
-rw-r--r--src/fe-gtk/xtext.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c
index e0ea0c37..121f35a3 100644
--- a/src/fe-gtk/xtext.c
+++ b/src/fe-gtk/xtext.c
@@ -1878,9 +1878,6 @@ gtk_xtext_unselect (GtkXText *xtext)
 {
 	xtext_buffer *buf = xtext->buffer;
 
-	if (buf->last_ent_start == NULL)
-		return;
-
 	xtext->skip_border_fills = TRUE;
 	xtext->skip_stamp = TRUE;
 
@@ -1901,7 +1898,6 @@ gtk_xtext_unselect (GtkXText *xtext)
 
 	xtext->skip_border_fills = FALSE;
 	xtext->skip_stamp = FALSE;
-	xtext->mark_stamp = FALSE;
 
 	xtext->buffer->last_ent_start = NULL;
 	xtext->buffer->last_ent_end = NULL;
@@ -1963,8 +1959,11 @@ gtk_xtext_button_release (GtkWidget * widget, GdkEventButton * event)
 		}
 
 		if (xtext->select_start_x == event->x &&
-			 xtext->select_start_y == event->y)
+			 xtext->select_start_y == event->y &&
+			 xtext->buffer->last_ent_start)
 		{
+			gtk_xtext_unselect (xtext);
+			xtext->mark_stamp = FALSE;
 			return FALSE;
 		}
 
@@ -2015,7 +2014,7 @@ gtk_xtext_button_press (GtkWidget * widget, GdkEventButton * event)
 		{
 			if (len == 0)
 				return FALSE;
-			gtk_xtext_unselect(xtext);
+			gtk_xtext_selection_clear (xtext->buffer);
 			ent->mark_start = offset;
 			ent->mark_end = offset + len;
 			gtk_xtext_selection_render (xtext, ent, ent);
@@ -2030,7 +2029,7 @@ gtk_xtext_button_press (GtkWidget * widget, GdkEventButton * event)
 		gtk_xtext_check_mark_stamp (xtext, mask);
 		if (gtk_xtext_get_word (xtext, x, y, &ent, 0, 0, 0))
 		{
-			gtk_xtext_unselect (xtext);
+			gtk_xtext_selection_clear (xtext->buffer);
 			ent->mark_start = 0;
 			ent->mark_end = ent->str_len;
 			gtk_xtext_selection_render (xtext, ent, ent);
@@ -2053,7 +2052,6 @@ gtk_xtext_button_press (GtkWidget * widget, GdkEventButton * event)
 		}
 	}
 
-	gtk_xtext_unselect (xtext);
 	xtext->button_down = TRUE;
 	xtext->select_start_x = x;
 	xtext->select_start_y = y;
@@ -2067,7 +2065,10 @@ gtk_xtext_button_press (GtkWidget * widget, GdkEventButton * event)
 static gboolean
 gtk_xtext_selection_kill (GtkXText *xtext, GdkEventSelection *event)
 {
-	gtk_xtext_unselect (xtext);
+#ifndef WIN32
+	if (xtext->buffer->last_ent_start)
+		gtk_xtext_unselect (xtext);
+#endif
 	return TRUE;
 }