mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
when joining comments, we skipped over whitespace to the left of caret twice, which caused characters to be deleted (PY-7286)
This commit is contained in:
@@ -420,11 +420,7 @@ public class PyJoinLinesHandler implements JoinRawLinesHandlerDelegate {
|
||||
int last = right_range.getEndOffset();
|
||||
while (pos < last && " \t".indexOf(text.charAt(pos)) >= 0) pos += 1;
|
||||
int right = pos - initial_pos + 1; // account for the '#'
|
||||
initial_pos = req.leftElem().getTextRange().getEndOffset() - 1;
|
||||
pos = initial_pos;
|
||||
while (" \t".indexOf(text.charAt(pos)) >= 0) pos -=1; // we'll end up at '#' if nothing else
|
||||
int left = initial_pos - pos;
|
||||
return new Result(" ", 0, left, right);
|
||||
return new Result(" ", 0, 0, right);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
# has the
|
||||
@@ -0,0 +1,2 @@
|
||||
# has <caret>
|
||||
# the
|
||||
@@ -61,6 +61,7 @@ public class PyJoinLinesTest extends PyTestCase {
|
||||
public void testTuple() { doTest(); }
|
||||
public void testTupleRPar() { doTest(); }
|
||||
public void testTwoComments() { doTest(); }
|
||||
public void testTwoComments2() { doTest(); } // PY-7286
|
||||
public void testTwoStatements() { doTest(); }
|
||||
public void testStringWithSlash() { doTest(); }
|
||||
public void testListOfStrings() { doTest(); }
|
||||
|
||||
@@ -98,7 +98,8 @@ public class PythonAllTestsSuite {
|
||||
PyMissingConstructorTest.class,
|
||||
PyPropertyAccessInspectionTest.class,
|
||||
Jinja2ParserTest.class,
|
||||
DjangoTemplateParserTest.class
|
||||
DjangoTemplateParserTest.class,
|
||||
PyJoinLinesTest.class
|
||||
};
|
||||
|
||||
public static TestSuite suite() {
|
||||
|
||||
Reference in New Issue
Block a user