Bug 43204 - Escaping text pasted in string literals is nasty
Summary: Escaping text pasted in string literals is nasty
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-17 04:02 EDT by Martin Aeschlimann CLA
Modified: 2006-08-16 07:08 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2003-09-17 04:02:31 EDT
20030917

String str1= "Hello\n";
String str2= "World";

Select '\n' from str1 and paste it at the end of str2.
The result is "World\\n" which is not what I wanted.

This is too much cleverness in my opinion. Paste can't really know if my string
is already escaped. It could guess, but this is not really possible.
A good thing is definitly to replace new lines in the string by '\n', but
escaping of backslashes is too much.
Comment 1 Dani Megert CLA 2003-09-17 04:27:02 EDT
Workaround: switch to non-smart mode (by pressing Insert) before pasting.

Tip: Disable to toggle into Overwrite mode when pressing Insert (Java > Work in
Progress page).

Comment 2 Tom Hofmann CLA 2003-09-17 04:58:46 EDT
You're right about the fact that Paste does not have any context about where the
pasted content comes from. Hard to find a good solution for everyday use.

An option would be to make Paste use the format it thinks fits the user's intent
best, but offer other options like "Paste Raw", "Paste Indented". A widely used
Word processor has this feature, calling it "Paste Special...".
Comment 3 Tom Hofmann CLA 2003-10-06 12:29:05 EDT
changed default preference for "escape strings" to false as the current state is
not satisfying. It is planned to introduce a "Paste Special" command that will
overtake this.

Resolving to LATER as this won't make it into M4.
Comment 4 Dani Megert CLA 2003-10-06 13:00:08 EDT
We normally use LATER if it does not make it into the release
Comment 5 Tom Hofmann CLA 2003-10-06 13:07:53 EDT
alright... reopening, and dropping priority
Comment 6 Kai-Uwe Maetzel CLA 2003-11-20 06:51:08 EST
Removing milestone tag.
Comment 7 Tom Hofmann CLA 2006-08-14 09:31:06 EDT
Moving back to inbox.
Comment 8 Martin Aeschlimann CLA 2006-08-16 06:29:16 EDT
I'm ok if you close this bug. There are workarounds as mentioned.
Comment 9 Dani Megert CLA 2006-08-16 07:08:54 EDT
see previous comment.