mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
Revert "Bounds-check terminal selection when clearing scrollback."
This reverts commit 80f5a009f6
.
After a bit more thought, I've decided it's the wrong way to solve the
problem. We shouldn't really be _changing_ the current selection
bounds in response to an event that touches the range they cover. With
this fix in place, if you clear the scrollback while a selection
partly overlaps it, and then extend the modified selection, you'll get
a selection one of whose endpoints is something you never specified as
a selection endpoint at all, and possibly paste the wrong text.
A better fix is to do the same thing we do about any other event that
touches the range covered by the selection: get rid of the selection
completely. For ease of cherry-picking (in case anyone needs to apply
the good fix in some downstream branch, or whatever), I'll make that
change separately in the next commit.
This commit is contained in:
parent
80f5a009f6
commit
a6a13311b4
23
terminal.c
23
terminal.c
@ -1600,24 +1600,6 @@ void term_reconfig(Terminal *term, Conf *conf)
|
||||
term_copy_stuff_from_conf(term);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ensure the position variables describing the ends of the terminal
|
||||
* selection are in bounds with respect to the actual extent of the
|
||||
* screen and scrollback.
|
||||
*/
|
||||
static void term_selection_bounds_check(Terminal *term)
|
||||
{
|
||||
pos lo, hi;
|
||||
lo.y = -count234(term->scrollback);
|
||||
lo.x = 0;
|
||||
hi.y = count234(term->screen);
|
||||
hi.x = term->cols - 1;
|
||||
|
||||
term->selstart = bound_pos(term->selstart, lo, hi);
|
||||
term->selend = bound_pos(term->selend, lo, hi);
|
||||
term->selanchor = bound_pos(term->selanchor, lo, hi);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear the scrollback.
|
||||
*/
|
||||
@ -1639,11 +1621,6 @@ void term_clrsb(Terminal *term)
|
||||
sfree(line); /* this is compressed data, not a termline */
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure we didn't invalidate selstart and selend in the process.
|
||||
*/
|
||||
term_selection_bounds_check(term);
|
||||
|
||||
/*
|
||||
* When clearing the scrollback, we also truncate any termlines on
|
||||
* the current screen which have remembered data from a previous
|
||||
|
@ -475,9 +475,4 @@ static inline bool decpos_fn(pos *p, int cols)
|
||||
#define incpos(p) incpos_fn(&(p), GET_TERM_COLS)
|
||||
#define decpos(p) decpos_fn(&(p), GET_TERM_COLS)
|
||||
|
||||
static inline pos bound_pos(pos p, pos lo, pos hi)
|
||||
{
|
||||
return poslt(p, lo) ? lo : poslt(p, hi) ? p : hi;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user