Re: RES: RES: RES: RES: vt newcons mouse paste issue FIXED

From: Hans Petter Selasky <hps_at_selasky.org>
Date: Thu, 23 Jun 2022 19:33:57 UTC
On 6/23/22 21:32, Ivan Quitschal wrote:
> 
>> Hi,
>>
>> Please test this latest version:
>> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Freviews.freebsd.org%2FD35552&amp;data=05%7C01%7C%7C8a105d5de0164d4b2eac08da554bfeb2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637916082154929613%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=0qxyXDZSJ3lElK7HGgK200mwrV3%2Bn%2Ftj5%2B5VbxFLxOA%3D&amp;reserved=0
> 
>> --HPS
> 
> Hi Hans
> 
> The version before worked just fine. I will test this one and let you know
> But I have a suggestion to make:
> 
> Today the trim is being done on every line , even on the last one . for example, if you mark the mouse:
> 
> |from here        |to here
> |                          |
> "Blablabla            "(you can see there are 10 spaces )
> _____________
> 
> It will only copy the Blablabla (im talking about the *last* line only, or when it's just one line)
> 
> What if you do something like this?
> 
> Moving this part of code into the "non last line block"
> 
> 		/* Add new line for all rows, but not for last one. */
> 		if (r != e.tp_row)
> 		{
> 			/* Trim trailing whitespace from each line, if any. */
> 			for (; i != j; i--) {
> 				if (TCHAR_CHARACTER(buf[i - 1]) == ' ')
> 					buf[i - 1] = '\0';
> 				else
> 					break;
> 			}
> 			buf[i++] = '\r';
> 		}
> 
> This way you would trim all the lines but the last one.
> Just an idea , what do you think?

Sounds reasonable. Let me update the patch.

--HPS