From nobody Fri Feb 25 16:23:05 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 15EAE19D6BCC; Fri, 25 Feb 2022 16:23:06 +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 4K4w6x6zWJz4fDR; Fri, 25 Feb 2022 16:23:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645806186; 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=jatpW5NEIBs2yfFUpoDSL8iONEO0sIHA/Edhyu2uHa4=; b=GHdaCcXA6LSc58R/w8XG4rbF1K/hfJx7qbmydWgk3V00LyFwvKfCzhX91fEeTCYry5cxbs eBWfjnjFqinkzpm7uGdayhjtpZK+jPL/uH7UrfiruHbVgyFmfhi96BludanKeZCLTPmJch qs/4ICZuODIoy1XITsvP0rJ538oa76x5ZWCyaR3U4d7ysMZye+gBshdw9Otp6aDGPc2GJk Mkzt0y7xdQlmuGBSaSToYZ8Jz4pUxlqxnJGyOigfD5OgoLwnF+EJRFrtbXEbElMCLYIv// 954+5F1hDjo2M1p+wLu8Tz91eyc+rtK/8TjgEev1Pa4Z1M+x6Xub4hsliWbCag== 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 D0C1122FEB; Fri, 25 Feb 2022 16:23:05 +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 21PGN5Oa044837; Fri, 25 Feb 2022 16:23:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21PGN5Ks044836; Fri, 25 Feb 2022 16:23:05 GMT (envelope-from git) Date: Fri, 25 Feb 2022 16:23:05 GMT Message-Id: <202202251623.21PGN5Ks044836@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: caeade0e00d5 - stable/12 - 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/12 X-Git-Reftype: branch X-Git-Commit: caeade0e00d50ec7a2392a3d28d85f2ec535344b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645806186; 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=jatpW5NEIBs2yfFUpoDSL8iONEO0sIHA/Edhyu2uHa4=; b=uNvuX5x4g3wF5jJ2y0HkjCG2EeMD+kZEvttyNZ1+XNgGy7biyIXzwZuCNYmZ33QIZitoqC Xee1cdJoQN8XMSvSFYMGGsW2f74ppZUPjGCRNHr1QdFRcCQ2BtFqphf/wQQbNuKFNlwYTK DiR5liugY6U41AXO6HyqepaStWpLWBJYoLuJFkI278QS2tMteovdaVs5f3RWVxtdr916xJ cv8nH3aCzCsTr1tR627/RSXbV3/xOqYmqU1NDYCjmGLQe+Jh9AKQKXw6eJgO2MX0qfWRef YaDXN8lK95nZFqL9U3m2KwLUIP3fJlqwqYZwJS5szl+Mrw326F0gtDPO5oQ0Zw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645806186; a=rsa-sha256; cv=none; b=o9HL8S4cETJQc3ClRvQPDOg6pcRvDnplOySPDHNnoFxGh31XTye1rcOwwYWGjmolpWIZXv WdSTlFNoEP+j3pr37BNNilcGRBhr5PhhpOPSpOY+IPWPFwrOknsY4HnmpRKKCONZGE6VVM xIuyUkROgOCmFEr98lafS1YBgeqfDEZ1McpxIAEtsueUoMvM9Rklj2qOXO1on3bK8LmO4Y 7VgW+jgQSQSUalkBaMc9zBYeh5ZvCjgYNZM4QyZg/KR2c2v2YkjO5OMZazvooHu2p+o7Hf NcvANwR7T31J8RfjecXyNW53xIAwBcfIA4WMZlOW+gVFTOGiFaczWhetcafM3g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=caeade0e00d50ec7a2392a3d28d85f2ec535344b commit caeade0e00d50ec7a2392a3d28d85f2ec535344b Author: Ed Maste AuthorDate: 2022-02-21 04:09:36 +0000 Commit: Ed Maste CommitDate: 2022-02-24 18:42:48 +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) (cherry picked from commit a861b27a45b0fc76bcb0dcf8ca53f1a831a13c2f) --- 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 be5d23b5d54d..bcc36a2e658f 100644 --- a/sys/dev/vt/vt_buf.c +++ b/sys/dev/vt/vt_buf.c @@ -786,12 +786,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;