diff options
author | RichardHitt <rbh00@netcom.com> | 2015-02-11 09:56:08 -0800 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2015-02-15 13:17:55 -0500 |
commit | 8ca96d7ea3ec0281802eb08174ca2fdcbcc8263f (patch) | |
tree | 726bfb7402ce3000354d1f3273f40810f01b9de0 /src/fe-gtk | |
parent | bbb81af55000bf7e2b59ba1f542de5a7d8478ee7 (diff) |
xtext: Unselect old selection on button press
Fixes #943 Closes #1293
Diffstat (limited to 'src/fe-gtk')
-rw-r--r-- | src/fe-gtk/xtext.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c index 121f35a3..e0ea0c37 100644 --- a/src/fe-gtk/xtext.c +++ b/src/fe-gtk/xtext.c @@ -1878,6 +1878,9 @@ 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; @@ -1898,6 +1901,7 @@ 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; @@ -1959,11 +1963,8 @@ gtk_xtext_button_release (GtkWidget * widget, GdkEventButton * event) } if (xtext->select_start_x == event->x && - xtext->select_start_y == event->y && - xtext->buffer->last_ent_start) + xtext->select_start_y == event->y) { - gtk_xtext_unselect (xtext); - xtext->mark_stamp = FALSE; return FALSE; } @@ -2014,7 +2015,7 @@ gtk_xtext_button_press (GtkWidget * widget, GdkEventButton * event) { if (len == 0) return FALSE; - gtk_xtext_selection_clear (xtext->buffer); + gtk_xtext_unselect(xtext); ent->mark_start = offset; ent->mark_end = offset + len; gtk_xtext_selection_render (xtext, ent, ent); @@ -2029,7 +2030,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_selection_clear (xtext->buffer); + gtk_xtext_unselect (xtext); ent->mark_start = 0; ent->mark_end = ent->str_len; gtk_xtext_selection_render (xtext, ent, ent); @@ -2052,6 +2053,7 @@ 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; @@ -2065,10 +2067,7 @@ gtk_xtext_button_press (GtkWidget * widget, GdkEventButton * event) static gboolean gtk_xtext_selection_kill (GtkXText *xtext, GdkEventSelection *event) { -#ifndef WIN32 - if (xtext->buffer->last_ent_start) - gtk_xtext_unselect (xtext); -#endif + gtk_xtext_unselect (xtext); return TRUE; } |