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

Previously when double-clicking on the last word on a line we would
select from the beginning of the word to the cursor position, because
we searched forward for a space character to find the end of a word.
Now, use the end of the line if we do not find a space.

PR:		261553
Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34339
This commit is contained in:
Ed Maste 2022-02-20 23:09:36 -05:00
parent 01f8011736
commit 521dbfd6b1

View File

@ -825,6 +825,10 @@ vtbuf_set_mark(struct vt_buf *vb, int type, int col, int row)
break;
}
}
/* No space - word extends to end of line. */
if (i == vb->vb_scr_size.tp_col)
vb->vb_mark_end.tp_col = i;
if (vb->vb_mark_start.tp_col > vb->vb_mark_end.tp_col)
vb->vb_mark_start.tp_col = vb->vb_mark_end.tp_col;
break;