You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Scott Palmer (Jira)" <ji...@apache.org> on 2021/03/26 16:37:00 UTC

[jira] [Created] (NETBEANS-5505) Pasting into a Java text block (multi-line string) fails to escape pasted backslashes

Scott Palmer created NETBEANS-5505:
--------------------------------------

             Summary: Pasting into a Java text block (multi-line string) fails to escape pasted backslashes
                 Key: NETBEANS-5505
                 URL: https://issues.apache.org/jira/browse/NETBEANS-5505
             Project: NetBeans
          Issue Type: Bug
          Components: java - Editor
    Affects Versions: 12.3
         Environment: NetBeans 12.3
Windows 10
Java 15.0.2
            Reporter: Scott Palmer


I had existing code with an empty text block
{code:java}
String text = """
""";
{code}
I copied some XML and pasted it into that block. Normally when pasting text into a Java String special characters are escaped e.g. quote characters are preceded with a backslash, backslashes are doubled up (e.g. a Windows path).

However when pasting into a text block single quotes don't need to be escaped, however backslashes were not escaped and they need to be.
See [https://docs.oracle.com/en/java/javase/15/text-blocks/index.html#translation-of-escape-sequences|https://docs.oracle.com/en/java/javase/15/text-blocks/index.html#translation-of-escape-sequences]
I ended up with this:
{code:java}
String text = """
    <property name="logFile">C:\temp\MyProgram.log</property>
""";
{code}
where the pasted lines with backslashes are marked as errors because the backslashes are not part of valid escape sequences, or they are valid escape sequences '\t' that do not correspond to the original text.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists