git: 521dbfd6b108 - main - vt: fix double-click word selection for last word on line

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Wed, 23 Feb 2022 15:57:45 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=521dbfd6b1085511769c419d44f11842e92067f5

commit 521dbfd6b1085511769c419d44f11842e92067f5
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-02-21 04:09:36 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-02-23 15:53:24 +0000

    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
---
 sys/dev/vt/vt_buf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/dev/vt/vt_buf.c b/sys/dev/vt/vt_buf.c
index a6352ef3c0ee..041c8193ca93 100644
--- a/sys/dev/vt/vt_buf.c
+++ b/sys/dev/vt/vt_buf.c
@@ -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;