From nobody Fri Feb 25 16:22:53 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3C4DE19D6644; Fri, 25 Feb 2022 16:22:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K4w6k1BBqz4dgF; Fri, 25 Feb 2022 16:22:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645806174; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jo24AaxKV75rekouOf+ioUR38Qqr8j3tXPBjOYcYF2Y=; b=Fyr+SlCUNSE/Vs0gTJKEoYvZjiPjnL9Sdv0xi0E8Rq4whvGTFw3+GMGZjaSOL7nm99iRJn dvBUEYanTHnLriEGtsvZsCS4B6q5YD38EXDF9zOCiknPgLdKXWIrgGSfwiGp0cMd4rC6sf NwRTdroA1e5njj5Y35wiYiGZbJ8pcL6tJNT1riiJlXkFbH0j8q/71fa8DlL7u87rvLTvh4 3PpDFRI/KXpv+mNaBpQqEpm9Gs28Lu/SPP5nmJERVvGzqhsKC/QPPHKIfV2NpDsEyZ64yV YGh4VHzVCgRWTS9Qnmj12DkZeVdUX7MXcQBfap+cNhzWl5YtNBQG/KrECpgpUg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08803227FB; Fri, 25 Feb 2022 16:22:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21PGMrZT044703; Fri, 25 Feb 2022 16:22:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21PGMrxU044702; Fri, 25 Feb 2022 16:22:53 GMT (envelope-from git) Date: Fri, 25 Feb 2022 16:22:53 GMT Message-Id: <202202251622.21PGMrxU044702@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: f6a7ce86fc2d - stable/13 - vt: fix double-click word selection for first/last word on line List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f6a7ce86fc2d2d13f169ff7b5f147858c445ec67 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645806174; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jo24AaxKV75rekouOf+ioUR38Qqr8j3tXPBjOYcYF2Y=; b=K6c1Yy2o6jbcgWvobL1c7yVVrS7jxXwiGJMY0XX2fxZn5Mqb322ktjAqLs8BY6Xd5qibMW 5wj9IEbMTVtea+79sk46BESx5tYogFVx1C5Enzage1aQIyIK9H+ho2lTHc19HvnDOU8U+C 7izzah3s1XrvnFIiSXKnv1k+Mt1Ov9Ew4b9oFwQJGLRMQEatlc1d/V9lQprgdgi2lQvna2 6sQNsE5s931X+3E/gkIuxnKP7xxqsv5DIzdwZGXELftADYMifvEAuXwk/1UdICMdz0qVi+ TGzGKjnSQOgJtjoK+1WUIhy7DWEFQDBpz/2wV5Kq4AU/LYxXVFhiJ91nMH9npw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645806174; a=rsa-sha256; cv=none; b=LZTUHF+I9e6f3UHzeL1z5B9zE+nJ026ErrnzPY0JITg1ZvqTWmbhpCa1OZaylQyCwd+o/5 AODbWbc1UWmA6dHbiR9vOXSMA02sllBzAxwyLWvtaYs2jZVKNPk/LNskio7e3hQlYs9GKn Y4YF+aTNN1TdnKlHKr4cKBQmj2uFoA1ofEYxm910L+QQaVKvupwMhQeityuEMHPr2j19hT IcrpOKYBTEIs/deHfUKMTI6LVs/8btdd/d85bg9l8qwFPigOrAzC7ERtDeKjr/vEDdF6JS e2hwat6SK/hY5eh1nU9eMPRjCv0lLTFMn8IuxhDIVawuyW03JMvwdIRfqEvI9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f6a7ce86fc2d2d13f169ff7b5f147858c445ec67 commit f6a7ce86fc2d2d13f169ff7b5f147858c445ec67 Author: Ed Maste AuthorDate: 2022-02-21 04:09:36 +0000 Commit: Ed Maste CommitDate: 2022-02-25 16:22:27 +0000 vt: fix double-click word selection for first/last 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. Similarly, when double-clicking on the last word on a line we would select from the beginning of the word to the cursor position rather than the end of the line. This is because we searched backward or forward for a space character to mark the beginning or end of a word. Now, use the beginning or end of the line if we do not find a space. PR: 261553 Sponsored by: The FreeBSD Foundation (cherry picked from commit 692bb3f0291b21337eb9a778f71a5b97a47e4c11) (cherry picked from commit 521dbfd6b1085511769c419d44f11842e92067f5) --- sys/dev/vt/vt_buf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/vt/vt_buf.c b/sys/dev/vt/vt_buf.c index 9c9417d6eca4..996dbe95902f 100644 --- a/sys/dev/vt/vt_buf.c +++ b/sys/dev/vt/vt_buf.c @@ -816,12 +816,19 @@ 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; 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;