mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-21 22:11:40 +07:00
IDEA-195293 Strange behavior when join lines with "builder.append('...')"
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
class Foo {
|
||||
void test() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
<caret>sb.append("long-long-long-long-long-long-long-long-long-long-long-long-long-long-long");
|
||||
sb.append("long-long-long-long-long-long-long-long-long-long-long-long-long-long-long");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Foo {
|
||||
void test() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("long-long-long-long-long-long-long-long-long-long-long-long-long-long-long")
|
||||
.append("long-long-long-long-long-long-long-long-long-long-long-long-long-long-long");<caret>
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
class Foo {
|
||||
void test(int a, int b) {
|
||||
if(a > 0 <caret>&& b < 0) System.out.println(a + b);
|
||||
if(a > 0 &<caret>& b < 0) System.out.println(a + b);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
class Foo {
|
||||
void test(int a, int b) {
|
||||
if(a > 0 && a < 10 <caret>&& b > 0 && b < 10) System.out.println(a + b);
|
||||
if(a > 0 && a < 10 &<caret>& b > 0 && b < 10) System.out.println(a + b);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ class Foo {
|
||||
int a = 2;
|
||||
int b = 2;
|
||||
|
||||
if (a == b && a > b) System.out.println();
|
||||
<selection>if (a == b && a > b) System.out.println();</selection>
|
||||
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Foo {
|
||||
void test(int a, int b) {
|
||||
if(a > 0 <caret>&& b < 0) {
|
||||
if(a > 0 &<caret>& b < 0) {
|
||||
System.out.println(a+b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,11 @@ public class JoinLinesTest extends LightCodeInsightTestCase {
|
||||
|
||||
public void testCallChain() { doTest(); }
|
||||
public void testCallChain2() { doTest(); }
|
||||
public void testCallChainLineBreak() {
|
||||
CommonCodeStyleSettings settings = getJavaSettings();
|
||||
settings.METHOD_CALL_CHAIN_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
|
||||
doTest();
|
||||
}
|
||||
public void testCallChainWrong() { doTest(); }
|
||||
public void testCallChainWrong2() { doTest(); }
|
||||
public void testDeclarationAndCall() { doTest(); }
|
||||
|
||||
@@ -187,12 +187,15 @@ public class JoinLinesHandler extends EditorActionHandler {
|
||||
if (rc != CANNOT_JOIN) break;
|
||||
}
|
||||
}
|
||||
docManager.doPostponedOperationsAndUnblockDocument(doc);
|
||||
|
||||
if (rc != CANNOT_JOIN) {
|
||||
RangeMarker marker = doc.createRangeMarker(rc, rc);
|
||||
docManager.doPostponedOperationsAndUnblockDocument(doc);
|
||||
rc = marker.getStartOffset();
|
||||
if (caretRestoreOffset.get() == CANNOT_JOIN) caretRestoreOffset.set(rc);
|
||||
return;
|
||||
}
|
||||
docManager.doPostponedOperationsAndUnblockDocument(doc);
|
||||
|
||||
int replaceStart = start == offsets.lineEndOffset ? start : start + 1;
|
||||
if (caretRestoreOffset.get() == CANNOT_JOIN) caretRestoreOffset.set(replaceStart);
|
||||
|
||||
Reference in New Issue
Block a user