From nobody Wed Oct 05 09:54:47 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 4Mj90R4cWLz4drb0; Wed, 5 Oct 2022 09:54:47 +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 4Mj90R481Nz3CW0; Wed, 5 Oct 2022 09:54:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664963687; 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=H7nkwxXhZwEUBN1wbfLXWr5BgJVtrGs2VZlbpU8VLCs=; b=dXxlGWqYKVhXrMbYv4C9lfPqsorAqENoRqLB4FBHNWmiB1oojyl68N3BoBKv7Z7YZLIN7H ynwlYi0aS7MBeThiWsCCs6E6kIQjL1UUBsfNV0ooERPg+jYFbmuG+3v46fYkziCCiWpTQH 4ZKgMMsiVSe0/2N0OfmgcPmDN+tzz15xiBujs0ZX9aUEeI5KDg0mBLYZMiXd3Vp/rH8EY/ Y96/+1vEvwdJMnvWsZfPpDSBhLN2q+KmuCdzedcgH37DGURbdo145YwdrZdcEPy3CzazY/ hIs9Un7aIBaYsVe88zJ4d5cTbyy8t+q068Z4RsTyrBzoGghOqD4uSaua67aVtQ== 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 4Mj90R3DCJzrxT; Wed, 5 Oct 2022 09:54:47 +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 2959sl2T055887; Wed, 5 Oct 2022 09:54:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2959slki055886; Wed, 5 Oct 2022 09:54:47 GMT (envelope-from git) Date: Wed, 5 Oct 2022 09:54:47 GMT Message-Id: <202210050954.2959slki055886@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 90b89100548f - main - 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/main X-Git-Reftype: branch X-Git-Commit: 90b89100548f7fef4cbd4a8c76dc3d83ab786d7a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664963687; 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=H7nkwxXhZwEUBN1wbfLXWr5BgJVtrGs2VZlbpU8VLCs=; b=rdFcvttDAKYHU2HXbtNDNi/x1OBHelUSvUP0OiB6+vV1cI2Xbi0Ka6w+alCZCg5NMIlKME fBD8fB9Mdm+X1Njyld6Lv/dkdmEA7Aks7+KaBYHmJRbw8sviMH0ngZrw0Rm8GbOrhjB/ki 9UcOu/VzQasjoVgI//5z/JLvvDJsY1raxzMZBXlUUQyQCwwOIJV9vm0afqDDT7rRcfjUQf sICQBP0QlagAcH7ZblfoTCMEShkGK3B7iNJ4r9XHHHQWC0g0uqRQB4rcABSnaCxYze/vd1 VfRXY3p7tIU6fIAAFWtK3nryC7dDg4a42oxK42423NQTn2YLUcaCRq608bSL4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664963687; a=rsa-sha256; cv=none; b=Nmoq/3zRN6Cacllz5Upsn77emcp6MmTtwRaLS4vgHN0B+AmcHuvKqRgR/rY7PGuKnkwHzC wlgT6oNwErIPMgz8RUT7UQAyw6uBRzMfPXvmoFJ0HQDNJiSEPW5BgAasP7BfkAvcKXuy9X 8V2ERryMI+8eAEq1zkFW0xdBI8/BpHNNalGEQGJW2XGK/uGll0WJ1ZmIKr0iSiiztlYxDo k0DEaebtvfj9UXfa/FP3q5iLEE06BQBjcY2OoabHjGbUFvIwUu/wsrENr4gmMf8jRIbvga DvcQU4NXM/N3daYKwd+HRGkj4OUd6eOe31XB0yI/O9XmXOqJ3ApzExwNy26rig== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=90b89100548f7fef4cbd4a8c76dc3d83ab786d7a commit 90b89100548f7fef4cbd4a8c76dc3d83ab786d7a Author: Ivan Quitschal AuthorDate: 2022-10-05 09:20:54 +0000 Commit: Hans Petter Selasky CommitDate: 2022-10-05 09:51:48 +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. MFC after: 1 week Sponsored by: NVIDIA Networking Differential Revision: https://reviews.freebsd.org/D36042 --- 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 06503e8897aa..f0ea59e134ac 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;