vt: fix double-click word selection for first word on line

Previously when double-clicking on the first word on a line we would
select from the cursor position to the end of the word, not from the
beginning of the line.  This is because we searched backward for a
space to mark the beginning of a word.

Now, use the beginning of the line if we do not find a space.

PR:		261553
Reported by:	Stefan B.
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Ed Maste 2022-02-20 23:09:36 -05:00
parent 1408672965
commit 692bb3f029

View File

@ -816,6 +816,9 @@ vtbuf_set_mark(struct vt_buf *vb, int type, int col, int row)
break;
}
}
/* No space - word extends to beginning of line. */
if (i == -1)
vb->vb_mark_start.tp_col = 0;
for (i = col; i < vb->vb_scr_size.tp_col; i ++) {
if (TCHAR_CHARACTER(r[i]) == ' ') {
vb->vb_mark_end.tp_col = i;