Discussion:
[Lazarus] Copy to clipboard from synedit
Michael Van Canneyt via Lazarus
2018-07-15 08:36:06 UTC
Permalink
Hi,

If you copy text to the clipboard in synedit, an extra #0 character is
copied at the end. It does not happen for other controls I tested.

I tested on Linux, 64-bit GTK2, but I suppose it will be the same for other
platforms/widgetsets.

This can be seen easily: copy some source text in the IDE. Paste it in
libreoffice writer. You'll get a # character at the end.

Some programs handle it well (xclip), some do not.
I've also had problems copying text e.g. to a browser.

I tested on Linux, 64-bit GTK2, but I suppose it will be the same for other
platforms/widgetsets.

Michael.
--
Mattias Gaertner via Lazarus
2018-07-15 09:18:14 UTC
Permalink
On Sun, 15 Jul 2018 10:36:06 +0200 (CEST)
Michael Van Canneyt via Lazarus <***@lists.lazarus-ide.org> wrote:

> Hi,
>
> If you copy text to the clipboard in synedit, an extra #0 character is
> copied at the end. It does not happen for other controls I tested.
>
> I tested on Linux, 64-bit GTK2, but I suppose it will be the same for other
> platforms/widgetsets.
>
> This can be seen easily: copy some source text in the IDE. Paste it in
> libreoffice writer. You'll get a # character at the end.
>
> Some programs handle it well (xclip), some do not.
> I've also had problems copying text e.g. to a browser.
>
> I tested on Linux, 64-bit GTK2, but I suppose it will be the same for other
> platforms/widgetsets.

A regression probably caused by this:
https://bugs.freepascal.org/view.php?id=21453

Mattias
--
Michael Van Canneyt via Lazarus
2018-07-15 10:07:28 UTC
Permalink
On Sun, 15 Jul 2018, Mattias Gaertner via Lazarus wrote:

> On Sun, 15 Jul 2018 10:36:06 +0200 (CEST)
> Michael Van Canneyt via Lazarus <***@lists.lazarus-ide.org> wrote:
>
>> Hi,
>>
>> If you copy text to the clipboard in synedit, an extra #0 character is
>> copied at the end. It does not happen for other controls I tested.
>>
>> I tested on Linux, 64-bit GTK2, but I suppose it will be the same for other
>> platforms/widgetsets.
>>
>> This can be seen easily: copy some source text in the IDE. Paste it in
>> libreoffice writer. You'll get a # character at the end.
>>
>> Some programs handle it well (xclip), some do not.
>> I've also had problems copying text e.g. to a browser.
>>
>> I tested on Linux, 64-bit GTK2, but I suppose it will be the same for other
>> platforms/widgetsets.
>
> A regression probably caused by this:
> https://bugs.freepascal.org/view.php?id=21453

It seems a fix is available but needs to be enabled using a define ?

Michael.
--
Martin Frb via Lazarus
2018-07-15 10:27:48 UTC
Permalink
On 15/07/2018 12:07, Michael Van Canneyt via Lazarus wrote:
>
>
> It seems a fix is available but needs to be enabled using a define ?

Please try with rev 58530

To be tested:

- Copy one word from synedit  to  synedit
- Copy one word from synedit  to  TEdit or TMemo
- Copy one word from synedit  to  libre office (or other external app)


All of the above with multiline / full line
All of the above in reverse
All of the above with "column mode selection"

Fold a begin/end (or any other) block in synedit.
Copy a selection containing the entire folded block.
Paste it in SynEdit => the pasted text should have the block folded
(assuming you did not disable this in options)

=====================
The old patch had a problem:

It removed the #0 from any clipboard data. Including Text, images, custom.
But the LCL only added the extra to text (and only if added via "AsText")

So any data added any other way, if it had a #0 (that was part of the
data) would be mangled.
SynEdit adds custom data (to preserve folds).


--
Martin Frb via Lazarus
2018-07-15 10:29:57 UTC
Permalink
Those tests should be done WITHOUT
GTK_REMOVE_CLIPBOARD_NULL
defined.

On 15/07/2018 12:27, Martin Frb via Lazarus wrote:
> On 15/07/2018 12:07, Michael Van Canneyt via Lazarus wrote:
>>
>>
>> It seems a fix is available but needs to be enabled using a define ?
>
> Please try with rev 58530
>
> To be tested:
>
> - Copy one word from synedit  to  synedit
> - Copy one word from synedit  to  TEdit or TMemo
> - Copy one word from synedit  to  libre office (or other external app)
>
>
> All of the above with multiline / full line
> All of the above in reverse
> All of the above with "column mode selection"
>
> Fold a begin/end (or any other) block in synedit.
> Copy a selection containing the entire folded block.
> Paste it in SynEdit => the pasted text should have the block folded
> (assuming you did not disable this in options)
>
> =====================
> The old patch had a problem:
>
> It removed the #0 from any clipboard data. Including Text, images,
> custom.
> But the LCL only added the extra to text (and only if added via "AsText")
>
> So any data added any other way, if it had a #0 (that was part of the
> data) would be mangled.
> SynEdit adds custom data (to preserve folds).
>
>

--
Michael Van Canneyt via Lazarus
2018-07-15 10:46:35 UTC
Permalink
Updated.

Tested copying word, line, multiline, and reversely selected to edit, memo, libreoffice.

All seems well. GTK2, linux, 64-bit.

Michael.



On Sun, 15 Jul 2018, Martin Frb via Lazarus wrote:

> Those tests should be done WITHOUT
> GTK_REMOVE_CLIPBOARD_NULL
> defined.
>
> On 15/07/2018 12:27, Martin Frb via Lazarus wrote:
>> On 15/07/2018 12:07, Michael Van Canneyt via Lazarus wrote:
>>>
>>>
>>> It seems a fix is available but needs to be enabled using a define ?
>>
>> Please try with rev 58530
>>
>> To be tested:
>>
>> - Copy one word from synedit  to  synedit
>> - Copy one word from synedit  to  TEdit or TMemo
>> - Copy one word from synedit  to  libre office (or other external app)
>>
>>
>> All of the above with multiline / full line
>> All of the above in reverse
>> All of the above with "column mode selection"
>>
>> Fold a begin/end (or any other) block in synedit.
>> Copy a selection containing the entire folded block.
>> Paste it in SynEdit => the pasted text should have the block folded
>> (assuming you did not disable this in options)
>>
>> =====================
>> The old patch had a problem:
>>
>> It removed the #0 from any clipboard data. Including Text, images,
>> custom.
>> But the LCL only added the extra to text (and only if added via "AsText")
>>
>> So any data added any other way, if it had a #0 (that was part of the
>> data) would be mangled.
>> SynEdit adds custom data (to preserve folds).
>>
>>
>
> --
> _______________________________________________
> Lazarus mailing list
> ***@lists.lazarus-ide.org
> https://lists.lazarus-ide.org/listinfo/lazarus
>
Juha Manninen via Lazarus
2018-07-15 12:04:11 UTC
Permalink
Amazing!
It is clear when looking at your commit but I did not understand the
clipboard issues enough when adding the workaround and
GTK_REMOVE_CLIPBOARD_NULL define.
I guess the define can be removed at some point. Martin, please do
that when all is proven to work.

Juha
--
Michael W. Vogel via Lazarus
2018-07-15 12:57:44 UTC
Permalink
Am 15.07.2018 um 12:27 schrieb Martin Frb via Lazarus:
> Please try with rev 58530

Tested all your requests on 64bit Windows 7 with 32bit Lazarus and
OpenOffice. No problems, work fine here!

Michl
--
Vojtěch Čihák via Lazarus
2018-07-15 12:39:30 UTC
Permalink
Hi,
 
I tested with Lazarus 1.9.0 r58530M FPC 3.1.1 x86_64-linux-qt. I tried also with -dDisableUTF8RTL
All works well with two exceptions:
 
1) folded block is copied folded only in implementation section. In interface section become unfolded (for example block TForm1 = class(TForm)...)
 
2) I don't know what is "Column Mode Selection"
 
Vojtěch
______________________________________________________________
> Od: Martin Frb via Lazarus <***@lists.lazarus-ide.org>
> Komu: ***@lists.lazarus-ide.org
> Datum: 15.07.2018 12:27
> Předmět: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re:
>
On 15/07/2018 12:07, Michael Van Canneyt via Lazarus wrote:
>
>
> It seems a fix is available but needs to be enabled using a define ?


--
_______________________________________________
Lazarus mailing list
***@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus <https://lists.lazarus-ide.org/listinfo/lazarus>
Juha Manninen via Lazarus
2018-07-15 13:26:09 UTC
Permalink
On Sun, Jul 15, 2018 at 3:39 PM Vojtěch Čihák via Lazarus
<***@lists.lazarus-ide.org> wrote:
> 2) I don't know what is "Column Mode Selection"

Alt-Shift with arrow keys select a column.

Juha
--
Vojtěch Čihák via Lazarus
2018-07-15 13:34:42 UTC
Permalink
Thanks,
 
column mode works well too.
 
V.
______________________________________________________________
> Od: Juha Manninen via Lazarus <***@lists.lazarus-ide.org>
> Komu: Lazarus mailing list <***@lists.lazarus-ide.org>
> Datum: 15.07.2018 15:26
> Předmět: Re: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re:
>
On Sun, Jul 15, 2018 at 3:39 PM Vojtěch Čihák via Lazarus
<***@lists.lazarus-ide.org> wrote:
> 2) I don't know what is "Column Mode Selection"

Alt-Shift with arrow keys select a column.

Juha
--
_______________________________________________
Lazarus mailing list
***@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus <https://lists.lazarus-ide.org/listinfo/lazarus>
Martin Frb via Lazarus
2018-07-15 14:40:49 UTC
Permalink
On 15/07/2018 14:39, Vojtěch Čihák via Lazarus wrote:
>
> Hi,
>
> I tested with Lazarus 1.9.0 r58530M FPC 3.1.1 x86_64-linux-qt. I tried
> also with -dDisableUTF8RTL
>
> All works well with two exceptions:
>
> 1) folded block is copied folded only in implementation section. In
> interface section become unfolded (for example block TForm1 =
> class(TForm)...)
>

Just tested, seems to depend:

if I paste it (folded TForm) into the "type" section, then it works.
Otherwise not. That is probably unrelated.
Vojtěch Čihák via Lazarus
2018-07-15 12:39:31 UTC
Permalink
Hi,
 
I tested with Lazarus 1.9.0 r58530M FPC 3.1.1 x86_64-linux-qt. I tried also with -dDisableUTF8RTL
All works well with two exceptions:
 
1) folded block is copied folded only in implementation section. In interface section become unfolded (for example block TForm1 = class(TForm)...)
 
2) I don't know what is "Column Mode Selection"
 
Vojtěch
______________________________________________________________
> Od: Martin Frb via Lazarus <***@lists.lazarus-ide.org>
> Komu: ***@lists.lazarus-ide.org
> Datum: 15.07.2018 12:27
> Předmět: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re:
>
On 15/07/2018 12:07, Michael Van Canneyt via Lazarus wrote:
>
>
> It seems a fix is available but needs to be enabled using a define ?


--
_______________________________________________
Lazarus mailing list
***@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus <https://lists.lazarus-ide.org/listinfo/lazarus>
Loading...