Bug 209976 - [typing] Escape on paste does not work for single character and not restricted to paste
Summary: [typing] Escape on paste does not work for single character and not restricte...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-15 11:09 EST by Dani Megert CLA
Modified: 2022-05-26 20:18 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2007-11-15 11:09:27 EST
I20071113-0800.

Escape on paste does not work for single character. This is due to a hack: the org.eclipse.jdt.internal.ui.text.java.JavaStringAutoIndentStrategy which kicks in when tpying also handles the escape on paste functionality and hence it cannot act/escpae on a single character.

The escape on paste code should be moved out of the JavaStringAutoIndentStrategy into its own IAutoEditStrategy strategy which is only registered when pasting.
Comment 1 Markus Keller CLA 2007-11-16 05:45:48 EST
Other cases to test:

1. With
- 'Wrap automatically' disabled and
- 'Escape when pasting' enabled,
pressing the 'Enter' key inside
			"|"
results in
			"\r\n" +
			"|"
if the document has Windows-style line delimiters (works fine with Unix or old Mac delimiters, since there's a special case for entering a single character)

Expected: should result in
			"
|"
(regardless of the 'Escape when pasting' option).

When 'Wrap automatically' is enabled, pressing 'Enter' should always result in
			"" +
			"|"

2. On paste of a line delimiter (or text with line delimiters) with 'Escape when pasting' enabled, the result should be:
- if 'Wrap automatically' is enabled:
			"\r\n" +
			"|"
- if 'Wrap automatically' is disabled:
			"\r\n|"



Also, the doc needs to be updated:

- Wrap automatically: If enabled, string literals are split into two lines and concatenated with a '+' when a line delimiter is inserted.

-Escape text when pasting into a string literal: If enabled, special characters in the clipboard are escaped when they are pasted into an existing string literal.
Comment 2 Dani Megert CLA 2007-11-16 07:14:18 EST
I've fixed case 1.
Comment 3 Mat Booth CLA 2018-06-21 07:59:32 EDT
The Photon release notes contain this new feature:

https://www.eclipse.org/eclipse/news/4.8/M3/#escape-non-ascii-when-pasting

But it does not work when pasting single characters. Even with this setting enabled, pasting a single unicode character results in no escaping.

I figured this bug has the same root cause.
Comment 4 Eclipse Genie CLA 2022-05-26 20:18:48 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.