diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java index 9689642b516..43b7ed48ba1 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java @@ -2150,10 +2150,11 @@ public class CodeFormatterVisitor extends CPPASTVisitor { final int line= scribe.line; boolean indented= false; try { + int[] stringLiterals = { Token.tSTRING, Token.tLSTRING }; while (true) { - scribe.printNextToken(Token.tSTRING, needSpace); + scribe.printNextToken(stringLiterals, needSpace); token= peekNextToken(); - if (token != Token.tSTRING) { + if (token != Token.tSTRING && token != Token.tLSTRING) { break; } scribe.printCommentPreservingNewLines(); diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java index 7e3ada37494..a123209585b 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java @@ -1332,4 +1332,19 @@ public class CodeFormatterTest extends BaseUITestCase { public void testCompositeTypeSpecAsMacro_Bug298592() throws Exception { assertFormatterResult(); } + + //void f() { + //w_char* p = L"wide string literal"; + //int x = 0; + //if (x == 0) x = 5;} + + //void f() { + // w_char* p = L"wide string literal"; + // int x = 0; + // if (x == 0) + // x = 5; + //} + public void testWideStringLiteral_Bug292626() throws Exception { + assertFormatterResult(); + } }