Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jun 2022 15:01:36 +0000
From:      Ivan Quitschal <tezeka@hotmail.com>
To:        Hans Petter Selasky <hps@selasky.org>, "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>, Kurt Jaeger <pi@freebsd.org>
Subject:   RES: RES: vt newcons mouse paste issue FIXED
Message-ID:  <CP6P284MB1900DD3D6F41CBAF38CF2CA4CBB29@CP6P284MB1900.BRAP284.PROD.OUTLOOK.COM>
In-Reply-To: <41ef5c38-515f-739a-cb47-7cab0e609526@selasky.org>
References:  <CP6P284MB1900CA1ED5B5BADE054ECB34CBB29@CP6P284MB1900.BRAP284.PROD.OUTLOOK.COM> <f6c1ee1c-bdd9-c8d6-1385-145022e6765d@selasky.org> <CP6P284MB1900CC7B7F6343DAB1D1E5BCCBB29@CP6P284MB1900.BRAP284.PROD.OUTLOOK.COM> <41ef5c38-515f-739a-cb47-7cab0e609526@selasky.org>

index | next in thread | previous in thread | raw e-mail

Hi Hans

Actually i can , I should've cut off the '\r' 😊 ,  this is what was causing the term to go bend

This is the correct diff (option -C 9999 doesn’t worked with -u)
I also included your code for the pts anyway



--- sys/dev/vt/vt_buf.c.orig    2022-06-22 11:48:39.705597000 -0300
+++ sys/dev/vt/vt_buf.c 2022-06-22 11:51:05.502415000 -0300
@@ -41,6 +41,7 @@
 #include <sys/malloc.h>
 #include <sys/mutex.h>
 #include <sys/reboot.h>
+#include <sys/ctype.h>
 
 #include <dev/vt/vt.h>
 
@@ -752,6 +753,7 @@
 {
        int i, r, c, cs, ce;
        term_pos_t s, e;
+       term_char_t *end;
 
        /* Swap according to window coordinates. */
        if (POS_INDEX(vtbuf_htw(vb, vb->vb_mark_start.tp_row),
@@ -772,10 +774,15 @@
                for (c = cs; c < ce; c++) {
                        buf[i++] = vb->vb_rows[r][c];
                }
+               for (end = buf + i; end-- != buf; ) {
+               if (isspace((unsigned char)*end) == false)
+                       break;
+               *end = '\0';
+               }
                /* Add new line for all rows, but not for last one. */
                if (r != e.tp_row) {
-                       buf[i++] = '\r';
                        buf[i++] = '\n';
+                       buf[i++] = '\0';
                }
        }
 }

Works fine here

Thanks

--tzk

-----Mensagem original-----
De: Hans Petter Selasky <hps@selasky.org> 
Enviada em: quarta-feira, 22 de junho de 2022 11:02
Para: Ivan Quitschal <tezeka@hotmail.com>; freebsd-current@freebsd.org
Assunto: Re: RES: vt newcons mouse paste issue FIXED

On 6/22/22 15:36, Ivan Quitschal wrote:
> Hi Hans
> 

Hi Ivan,

I think you should upload the diff at:

https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Freviews.freebsd.org%2Fdifferential%2F&amp;data=05%7C01%7C%7C85e3f391dfc941f2852908da5457c75f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637915033252675801%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=4sxXIR9NhIbwD42gIrP4pYcdnUinqae1SNZAjclr2Aw%3D&amp;reserved=0

Make the diff like this:

diff -u -C 999999 sys/dev/vt/vt_buf.c.orig sys/dev/vt/vt_buf.c > a.diff


I see two issues:

1) Pointer arithmetics is not so good!

>                 }
> +               end = buf + i - 1;
> +               while (end > buf && isspace((unsigned char)*end))
> +               {
> +                       *end = '\0';
> +                       end--;
> +               }
> +

I think this would be better and avoid the ">" with pointers!

for (end = buf + i; end-- != buf; ) {
    if (isspace((unsigned char)*end) == false)
	break;
    *end = '\0';
}

Can you explain this:

> -                       buf[i++] = '\r';
> +                       buf[i] = '\r';
>                         buf[i++] = '\n';

'\r' character is now overwritten by '\n' character.

--HPS

help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CP6P284MB1900DD3D6F41CBAF38CF2CA4CBB29>