This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 222418 - Patch for: Pasting a string containing newlines should insert "+" escapes does not work for clipboard-content from external applications
Summary: Patch for: Pasting a string containing newlines should insert "+" escapes doe...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords: PATCH_AVAILABLE
Depends on:
Blocks:
 
Reported: 2012-11-19 18:20 UTC by markiewb
Modified: 2012-11-20 15:50 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Showing the error (38.60 KB, image/png)
2012-11-19 18:22 UTC, markiewb
Details
Proposed patch (1.21 KB, patch)
2012-11-19 18:29 UTC, markiewb
Details | Diff
Patch in action (8.65 KB, image/png)
2012-11-19 18:30 UTC, markiewb
Details
Proposed patch - sanatized (908 bytes, patch)
2012-11-19 18:32 UTC, markiewb
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2012-11-19 18:20:30 UTC
[ BUILD # : 201211062253 ]
[ JDK VERSION : 1.7.9 ]

The feature "Pasting a string containing newlines should insert "+" 
escapes" was introduced by http://netbeans.org/bugzilla/show_bug.cgi?
id=201130. That is nice.

BUT it does not always work when the clipboard content is from an external 
program.

Reproduction: 
* Copy the SQL-Query from https://blogs.oracle.com/geertjan/entry/
paste_a_multiline_literal to clipboard. 
* Open a java editor and paste the content within a String literal like 
<code>String ab="insert | here"</code>

ACTUAL: no escaped newlines and no '+' - see screenshot
EXPECTED: escaped newlines and '+'
Comment 1 markiewb 2012-11-19 18:22:42 UTC
Created attachment 128088 [details]
Showing the error
Comment 2 markiewb 2012-11-19 18:26:36 UTC
(In reply to comment #0)
> Reproduction: 
> * Copy the SQL-Query from https://blogs.oracle.com/geertjan/entry/
> paste_a_multiline_literal to clipboard. 
> * Open a java editor and paste the content within a String literal like 
> <code>String ab="insert | here"</code>

More exact reproduction: 
* Copy the SQL-Query from https://blogs.oracle.com/geertjan/entry/
paste_a_multiline_literal to clipboard. 
* Paste it to a notepad.exe instance and copy the text from there
* Open a java editor and paste the content within a String literal like 
<code>String ab="insert | here"</code>
Comment 3 markiewb 2012-11-19 18:29:28 UTC
Created attachment 128089 [details]
Proposed patch

I like to propose this patch. 
Details: Within #getTransferDataFlavors() the dataFlavor plain Strings are preferred so that they can be modified in #getTransferData() on pasting. 

@NB-Devs: Please review the patch. Thank you
Comment 4 markiewb 2012-11-19 18:30:38 UTC
Created attachment 128090 [details]
Patch in action
Comment 5 markiewb 2012-11-19 18:32:36 UTC
Created attachment 128092 [details]
Proposed patch - sanatized
Comment 6 Dusan Balek 2012-11-20 15:50:45 UTC
Should be already fixed in the current dev build.

http://hg.netbeans.org/main-silver/rev/720f1524a1f7