Bug #63753 Copied text from value editor has extra lines between existing lines
Submitted: 14 Dec 2011 22:07 Modified: 27 Jul 2012 8:17
Reporter: Bob Dankert Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S2 (Serious)
Version:5.2.36 OS:Windows (W7 64)
Assigned to: CPU Architecture:Any
Tags: copy, line, value editor

[14 Dec 2011 22:07] Bob Dankert
Description:
When I copy the text from the value editor for a field, the copied text has an extra blank line (carriage return line feed) between each line that is copied.  For example, if the copied text should be:

Line 1<Line feed>
Line 2<Line feed>
Line 3<Line feed>

I actually get:

Line 1<Line Feed>
<Carriage Return><Line Feed>
Line 2<Line feed>
<Carriage Return><Line Feed>
Line 3<Line Feed>

Note that this does not happen when I use the context menu options for "Copy field content", those copy the text correctly.

How to repeat:
Copy text which has line feeds from the value editor, inspect the contents of the clipboard and you will find extra \r\n's between each line.  

Suggested fix:
Do not add extra line spaces when copying text.
[18 Dec 2011 17:36] Valeriy Kravchuk
Please, send exact CREATE TABLE statement for the table you tried to edit and specify what column you opened in value editor.
[21 Dec 2011 18:02] Bob Dankert
It's really quite easy, any multiline text field will work.  Here's an example:

create table linetest (field text);
insert into linetest values ('First Line\nSecond Line\nThird Line');
select * from linetest;

In the results in workbench, right click on the field, click "Open Value in Viewer".  Select all the text (right click, select all), copy the text (right click, copy, or Ctrl-C), and inspect the clipboard.  The contents will be:

First Line\r\r\nSecond Line\r\r\nThird Line\r\r\n

If instead of copying the field from the "Value Viewer" window, if you right click on the field in Workbench and select "Copy Field Content" (quoted or unquoted, it doesn't matter), then inspect the clipboard.  The contents will  be:

First Line\r\nSecond Line\r\nThird Line

Note that this is now \r\n instead of the inserted \n, although this is likely due to it being on Windows and Windows using \r\n by default.  None-the-less, copying the text from the value viewer causes it to copy \r\r\n for each \n instance.

I viewed the contents of the clipboard in a couple methods.  I first noticed it by pasting into EditPadPro, which I have set to visually show carriage returns and line feeds.  I also created a basic windows application which shows the contents of the clipboard, using Clipboard.GetText() in C# - this confirmed my findings.

Let me know if there is any additional information you need to verify this bug.
[22 Dec 2011 8:55] Valeriy Kravchuk
File with value pasted...

Attachment: a.txt (text/plain), 39 bytes.

[22 Dec 2011 8:56] Valeriy Kravchuk
Verified on Windows XP.
[27 Jul 2012 8:17] Philip Olson
Fixed as of Workbench 5.2.41, and here's the changelog entry:

After right-clicking on a value in the SQL editor and choosing
Open Value in Viewer, selecting the text
would insert extra new lines into the clipboard.