]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
`Copy All' ought to de-highlight any existing selection, in line
authorSimon Tatham <anakin@pobox.com>
Fri, 11 Apr 2003 18:10:13 +0000 (18:10 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 11 Apr 2003 18:10:13 +0000 (18:10 +0000)
with any other operation that shifts the X selection to stuff other
than the highlighted text.

[originally from svn r3098]

terminal.c
unix/pterm.c

index cd32a7e43f3b76046b0ab39b34e322d931088a9c..8e012f5070a7e826e97b582fc4364096762a9814 100644 (file)
@@ -3555,7 +3555,7 @@ void term_scroll(Terminal *term, int rel, int where)
     term_update(term);
 }
 
-static void clipme(Terminal *term, pos top, pos bottom, int rect)
+static void clipme(Terminal *term, pos top, pos bottom, int rect, int desel)
 {
     wchar_t *workbuf;
     wchar_t *wbptr;                   /* where next char goes within workbuf */
@@ -3703,7 +3703,7 @@ static void clipme(Terminal *term, pos top, pos bottom, int rect)
     wblen++;
     *wbptr++ = 0;
 #endif
-    write_clip(term->frontend, workbuf, wblen, FALSE); /* transfer to clipbd */
+    write_clip(term->frontend, workbuf, wblen, desel); /* transfer to clipbd */
     if (buflen > 0)                   /* indicates we allocated this buffer */
        sfree(workbuf);
 }
@@ -3713,7 +3713,7 @@ void term_copyall(Terminal *term)
     pos top;
     top.y = -sblines(term);
     top.x = 0;
-    clipme(term, top, term->curs, 0);
+    clipme(term, top, term->curs, 0, TRUE);
 }
 
 /*
@@ -4178,7 +4178,7 @@ void term_mouse(Terminal *term, Mouse_Button braw, Mouse_Button bcooked,
             * data to the clipboard.
             */
            clipme(term, term->selstart, term->selend,
-                  (term->seltype == RECTANGULAR));
+                  (term->seltype == RECTANGULAR), FALSE);
            term->selstate = SELECTED;
        } else
            term->selstate = NO_SELECTION;
index 14fb45de038a8711478418c700fd3d1b26989498..1fa1f9927a6ce515286b373c0b56c852c6cc8758 100644 (file)
@@ -1312,6 +1312,9 @@ void write_clip(void *frontend, wchar_t * data, int len, int must_deselect)
            gtk_selection_add_target(inst->area, GDK_SELECTION_PRIMARY,
                                     utf8_string_atom, 1);
     }
+
+    if (must_deselect)
+       term_deselect(inst->term);
 }
 
 void selection_get(GtkWidget *widget, GtkSelectionData *seldata,