Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2018-07

Copy to clipboard from synedit

13 messages · 6 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

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.

Reply by email

Mattias Gaertner
to Michael Van Canneyt
Show quoted text 16 lines
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

Reply by email

Michael Van Canneyt
to Mattias Gaertner
Mattias Gaertner wrote 22 lines
On Sun, 15 Jul 2018 10:36:06 +0200 (CEST) Michael Van Canneyt via Lazarus 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.

Reply by email

Martin Frb
to Michael Van Canneyt
Michael Van Canneyt 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).

Reply by email

Martin Frb
to Martin Frb

Those tests should be done WITHOUT
GTK_REMOVE_CLIPBOARD_NULL
defined.

Martin Frb wrote 35 lines
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).

Reply by email

Michael Van Canneyt
to Martin Frb

Updated.

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

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

Michael.

Martin Frb wrote 47 lines
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 https://lists.lazarus-ide.org/listinfo/lazarus

Reply by email

Juha Manninen
to Michael Van Canneyt

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

Reply by email

Vojtěch Čihák
to Michael Van Canneyt: It seems a fix is available but needs to be enabled using a define ? Michael.

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
______________________________________________________________

Show quoted text 5 lines
Od: Martin Frb via Lazarus Komu: Datum: 15.07.2018 12:27 Předmět: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re:
Michael Van Canneyt wrote
It seems a fix is available but needs to be enabled using a define ?

Reply by email

Vojtěch Čihák
to Michael Van Canneyt: It seems a fix is available but needs to be enabled using a define ? Michael.

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
______________________________________________________________

Show quoted text 5 lines
Od: Martin Frb via Lazarus Komu: Datum: 15.07.2018 12:27 Předmět: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re:
Michael Van Canneyt wrote
It seems a fix is available but needs to be enabled using a define ?

Reply by email

Martin Frb
to Vojtěch Čihák:   I tested with Lazarus 1.9.0 r58530M FPC 3.1.1 x86_64-linux-qt. I tried also with…
Vojtěch Čihák wrote 12 lines
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180715/73c6df50/attachment.html>

Reply by email