From nobody Wed Oct 12 15:54:18 2022 X-Original-To: dev-commits-src-all@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 4Mncf24BNdz4fdY2; Wed, 12 Oct 2022 15:54:18 +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 4Mncf23MYLz3H3Z; Wed, 12 Oct 2022 15:54:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665590058; 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=bw4pwXtPc7mdqc70RNte1pWB7HQFaN8UhVemmo1S+Ro=; b=oA6KwkWN1fzntNcTK9qp2tMw10s5iLcJgZkvhuckA2tBJLQnsGsaOLGjVYYPLJ56Hggnsj rw4Y4VPruAKf1hMz0iVxY7TpGQ4KaoKO2/LHzEzeFt2zzOSoIDRsJ34WrtKNm+p14DQ8Zk omp4d/tD8K317aRVms5bLnV1IRVIrVdbWHyRimrItjvxBOayEJSrkAbtO24bK+0//ryGhT TyeD5BanHSMczUkq9K/9wcUQ5NxttAzD72qFmToCbC54w0OSssODxsJwgh8So0R42APi8W CJr9KF1/0mxQ4RwKJ0beMGL3gbfTNIxRFFiXKL2hftUcbwScdowgUmlQwwwpHA== 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 4Mncf22QwHz1M4d; Wed, 12 Oct 2022 15:54:18 +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 29CFsIgI043885; Wed, 12 Oct 2022 15:54:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29CFsIaj043884; Wed, 12 Oct 2022 15:54:18 GMT (envelope-from git) Date: Wed, 12 Oct 2022 15:54:18 GMT Message-Id: <202210121554.29CFsIaj043884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 7edcf5ac8afb - stable/13 - vt(4): When cutting a line, append a newline character. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7edcf5ac8afb49f4532c512839bffa130bcfb985 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665590058; 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=bw4pwXtPc7mdqc70RNte1pWB7HQFaN8UhVemmo1S+Ro=; b=D0noNjx9YMSqk3sMtXk1t3wI+z8d1pFsp1XSocyQ9rtsgb4y/U45YlaLaNh7KR3bxDAdjQ FbRkIk4+lzM/4VijI5TfgaPNBvo8FJwdNAo7xOTT4umPiyJ6h2E+RmuHPxDc0R4ropHBf7 MAto29xYaEvc3e6z7TxW10F6Kz2dLIjBfDq3Wc7FPVGxAPqw5L5BXHpXb2K5o6z7sKGb70 y3/pSu07+anjlk+wWuyU22+sDkglMiRYGIiIranYuFdNJd3pYiuT4uR/E3fPGBIaZJiSRi R+MHEm6LlMmkrDkmvrIUVVF8NMYCz0ziwvJiY5x5k8tTpiFNv9rgOTnBbi5n2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665590058; a=rsa-sha256; cv=none; b=yLyBI0TiSzldtU1Y73+FxOZuy7W+nlWINNCuJYzVNoF9YEflWM535028236UQv/jJjIUPL 5oQcDG1huOi1bgd2XPj+AxSn6g84QG8Rf9X3Y6HCDCqh/NA7gtljuuZx+ciY5DBlYOwuXF fHdxFVfs+it+cZ/9a0CnyDs6tmegctK0RDfFWSgHaPanXS3AWLgA0Q1t26V7wHbrRbCrW5 AJ3IwgHEac3yhMT2Lmsp855S+mE8bakJNfFcEGkoREk2gOhAu7qMw2+h3Cy7lpM1Pn4QZg G7EMS/pGLM4NQqPj5ZqXaLm6BzYLo6OhcF+TqpdToAEPO3Ic6/pZ7LI5ps6xUw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=7edcf5ac8afb49f4532c512839bffa130bcfb985 commit 7edcf5ac8afb49f4532c512839bffa130bcfb985 Author: Ivan Quitschal AuthorDate: 2022-10-05 09:20:54 +0000 Commit: Hans Petter Selasky CommitDate: 2022-10-12 15:53:21 +0000 vt(4): When cutting a line, append a newline character. While at it optimise "case 3" into a default. This way there is no need to initialize the "mark" variable in the beginning, because all cases set it. Sponsored by: NVIDIA Networking Differential Revision: https://reviews.freebsd.org/D36042 (cherry picked from commit 90b89100548f7fef4cbd4a8c76dc3d83ab786d7a) --- sys/dev/vt/vt.h | 2 +- sys/dev/vt/vt_buf.c | 6 +++--- sys/dev/vt/vt_core.c | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/sys/dev/vt/vt.h b/sys/dev/vt/vt.h index 7305727804cf..977372f04a7d 100644 --- a/sys/dev/vt/vt.h +++ b/sys/dev/vt/vt.h @@ -239,7 +239,7 @@ void vtbuf_cursor_visibility(struct vt_buf *, int); #ifndef SC_NO_CUTPASTE int vtbuf_set_mark(struct vt_buf *vb, int type, int col, int row); int vtbuf_get_marked_len(struct vt_buf *vb); -void vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz); +void vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz, int mark); #endif #define VTB_MARK_NONE 0 diff --git a/sys/dev/vt/vt_buf.c b/sys/dev/vt/vt_buf.c index b83db85f1cdb..88e4fc472f9d 100644 --- a/sys/dev/vt/vt_buf.c +++ b/sys/dev/vt/vt_buf.c @@ -742,7 +742,7 @@ vtbuf_get_marked_len(struct vt_buf *vb) ei = e.tp_row * vb->vb_scr_size.tp_col + e.tp_col; /* Number symbols and number of rows to inject \r */ - sz = ei - si + (e.tp_row - s.tp_row); + sz = ei - si + (1 + e.tp_row - s.tp_row); return (sz * sizeof(term_char_t)); } @@ -771,7 +771,7 @@ tchar_is_word_separator(term_char_t ch) } void -vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz) +vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz, int mark) { int i, j, r, c, cs, ce; term_pos_t s, e; @@ -799,7 +799,7 @@ vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz) buf[i++] = vb->vb_rows[r][c]; /* For all rows, but the last one. */ - if (r != e.tp_row) { + if (r != e.tp_row || mark == VTB_MARK_ROW) { /* Trim trailing word separators, if any. */ for (; i != j; i--) { if (!tchar_is_word_separator(buf[i - 1])) diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index cd57e8fc9420..1e0225fc2ea3 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -2153,7 +2153,6 @@ vt_mouse_event(int type, int x, int y, int event, int cnt, int mlevel) vd = main_vd; vw = vd->vd_curwindow; vf = vw->vw_font; - mark = 0; if (vw->vw_flags & (VWF_MOUSE_HIDE | VWF_GRAPHICS)) /* @@ -2217,7 +2216,7 @@ vt_mouse_event(int type, int x, int y, int event, int cnt, int mlevel) case 2: /* double click: cut a word */ mark = VTB_MARK_WORD; break; - case 3: /* triple click: cut a line */ + default: /* triple click: cut a line */ mark = VTB_MARK_ROW; break; } @@ -2286,7 +2285,7 @@ vt_mouse_event(int type, int x, int y, int event, int cnt, int mlevel) VD_PASTEBUFSZ(vd) = len; } /* Request copy/paste buffer data, no more than `len' */ - vtbuf_extract_marked(&vw->vw_buf, VD_PASTEBUF(vd), len); + vtbuf_extract_marked(&vw->vw_buf, VD_PASTEBUF(vd), len, mark); VD_PASTEBUFLEN(vd) = len;