RES: vt newcons 3 clicks mouse paste issue FIXED

From: Ivan Quitschal <tezeka_at_hotmail.com>
Date: Thu, 04 Aug 2022 14:32:07 UTC
Thank you Warner

Done

https://reviews.freebsd.org/D36042
D36042

Just to make clear. I'll put here what I wrote in the comments


we have two changes in this patch.

first one is regarding the 3 clicks paste.
vtbuf_extract_marked() gains a new arg
int mark

the second change is not much of a change because i had to mess up the
"case VT_MOUSE_EXTENDBUTTON:"

this change is regarding the highlight mark that doesn't go away from the screen after you paste it. the highlight mark stays forever
the below solves the problem

I've replaced
mark = VTB_MARK_EXTEND;
with
mark = VTB_MARK_START

also included  "mark = VTB_MARK_START" and removed the return from
               case VT_MOUSE_PASTEBUTTON:

first change is 100% ok (the 3click pasting)
second one needs an overlook on where to put this "VTB_MARK_START" without messing up the switch option "VT_MOUSE_EXTENDBUTTON"

thanks

--tzk


De: Warner Losh <imp@bsdimp.com>
Enviada em: quinta-feira, 4 de agosto de 2022 11:12
Para: Ivan Quitschal <tezeka@hotmail.com>
Cc: Hans Petter Selasky <hps@selasky.org>; freebsd-current@freebsd.org
Assunto: Re: vt newcons 3 clicks mouse paste issue FIXED



On Thu, Aug 4, 2022 at 8:04 AM Ivan Quitschal <tezeka@hotmail.com<mailto:tezeka@hotmail.com>> wrote:
Hi Hans

D36042 created
How can I include more patch files in the same defect number? D36042
https://reviews.freebsd.org/D36042<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Freviews.freebsd.org%2FD36042&data=05%7C01%7C%7Cae9c4e72021942fc626908da76236453%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637952191654414206%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3sVOGwTYeCM1YjjLv8ta6DzDD6kBAehqnJWvn2dKSec%3D&reserved=0>

Its missing the vt.h.diff and vt_core.diff
Both attached

Should i have put all three in the raw patch creation combo box when I was creating the defect?
Sorry my dumbness  , never used that phabricator

Generate the diff with 'git diff -U99999' to pick up all the changes at once and to give reviewers
enough context. Either don't specify any files, or specify all the ones in the change (depending
on the state of your tree). Upload that diff. you can use the web interface to 'update' the diff to
include everything, no need to make a new one.

Warner

--tzk





> -----Mensagem original-----
> De: Ivan Quitschal <tezeka@hotmail.com<mailto:tezeka@hotmail.com>>
> Enviada em: terça-feira, 2 de agosto de 2022 09:34
> Para: Hans Petter Selasky <hps@selasky.org<mailto:hps@selasky.org>>
> Cc: Tomoaki AOKI <junchoon@dec.sakura.ne.jp<mailto:junchoon@dec.sakura.ne.jp>>; Ivan Quitschal
> <tezeka@hotmail.com<mailto:tezeka@hotmail.com>>; freebsd-current@freebsd.org<mailto:freebsd-current@freebsd.org>; Kurt Jaeger
> <pi@freebsd.org<mailto:pi@freebsd.org>>
> Assunto: vt newcons 3 clicks mouse paste issue FIXED
>
>
> Hi guys
>
> Currently , if you click 3 times in order to select the entire row, its just not
> working as it should.
> i fixed that please find below and attached the patches
>
> With this change now we can do a 3 clicks and paste , i dont know, in some
> command, and it will be executed just fine, like it was in syscons, and still is in
> xterm/ linux etc
>
> now if the event is a 3 mouse clickss select, the space trim is made on the right
> and an <enter> is included
>
> thanks
>
> --tzk
>
>
> --------------------
> --- sys/dev/vt/vt_buf.c.orig    2022-08-02 08:44:27.229782000 -0300
> +++ sys/dev/vt/vt_buf.c 2022-08-02 08:45:02.703697000 -0300
> @@ -771,7 +771,7 @@
>   }
>
>   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 @@
>                          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]))
> --------------------
>
> --- sys/dev/vt/vt_core.c.orig   2022-08-02 08:43:15.436415000 -0300
> +++ sys/dev/vt/vt_core.c        2022-08-02 08:43:49.120096000 -0300
> @@ -2287,7 +2287,7 @@
>                          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;
>
> ---------------------
>
> --- sys/dev/vt/vt.h.orig        2022-08-02 08:41:23.888584000 -0300
> +++ sys/dev/vt/vt.h     2022-08-02 08:41:54.504309000 -0300
> @@ -238,7 +238,7 @@
>   #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
> --------------------------