From c076966d2fa180f36b1d5b02f63fe174ae641e3d Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 11 Apr 2003 18:10:13 +0000 Subject: [PATCH] `Copy All' ought to de-highlight any existing selection, in line with any other operation that shifts the X selection to stuff other than the highlighted text. git-svn-id: svn://svn.tartarus.org/sgt/putty@3098 cda61777-01e9-0310-a592-d414129be87e --- terminal.c | 8 ++++---- unix/pterm.c | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/terminal.c b/terminal.c index cd32a7e4..8e012f50 100644 --- a/terminal.c +++ b/terminal.c @@ -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; diff --git a/unix/pterm.c b/unix/pterm.c index 14fb45de..1fa1f992 100644 --- a/unix/pterm.c +++ b/unix/pterm.c @@ -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, -- 2.11.0