On Wed, May 14, 2025 at 02:10:51AM +0200, Vincent Lefevre wrote: > On 2025-05-14 01:59:38 +0200, Vincent Lefevre wrote: > > Package: xterm > > Version: 398-1 > > Severity: normal > > > > When I double-click on a word at the beginning of a line such that > > this word is preceded by spaces, one space is incorrectly included > > in the selection. > > > > For instance, type > > > > printf "%$((COLUMNS+1))syz\n" x > > > > which gives a line full of spaces and the word "xyz" on the next > > physical line. If I double-click on the word "xyz", only "xyz" > > is highlighted as expected, but if I paste the selection with > > the middle-button, I get " xyz", i.e. with a preceding space. > > Note that this is a regression in the latest version. > Version 397-1 did not have this issue.
That was from
* fix several minor issues reported by Coverity.
but in addressing a warning about overflow, I overlooked the special case
where lastcol is one past the right margin, in this function:
static int
Length(TScreen *screen,
int row,
int scol,
int ecol)
{
CLineData *ld = GET_LINEDATA(screen, row);
const int lastcol = LastTextCol(screen, ld, row);
if (ecol > lastcol)
ecol = lastcol;
if (ecol < scol) /* scol is less than lastcol in this instance */
ecol = scol;
return (ecol - scol + 1);
}
I'll amend that to ensure the function returns a positive value...
--
Thomas E. Dickey <[email protected]>
https://invisible-island.net
signature.asc
Description: PGP signature

