fixed PY-5196 Move statement: gets stuck on moving class after compound statement

This commit is contained in:
Ekaterina Tuzova
2011-12-02 12:05:34 +01:00
parent fbee7c314f
commit 3c98006baf
5 changed files with 26 additions and 1 deletions
@@ -203,7 +203,7 @@ public class StatementMover extends LineMover {
if (tmp != null) {
int start = editor.offsetToLogicalPosition(tmp.getParent().getTextRange().getStartOffset()).line;
int end = editor.offsetToLogicalPosition(tmp.getParent().getTextRange().getEndOffset()).line;
if (start == end && start == info.toMove2.startLine)
if (start == info.toMove2.startLine && (start == end || tmp.getParent() instanceof PyClass || tmp.getParent() instanceof PyFunction))
element2 = tmp;
else
element2 = PyPsiUtils.getSignificantToTheLeft(element2, true);
+7
View File
@@ -0,0 +1,7 @@
if condition:
test1()
class B(Exception):
b=1
clas<caret>s C:
pass
+7
View File
@@ -0,0 +1,7 @@
if condition:
test1()
class B(Exception):
b=1
clas<caret>s C:
pass
+7
View File
@@ -0,0 +1,7 @@
if condition:
test1()
class C:
pass
class B(Exception):
b=1
@@ -103,4 +103,8 @@ public class PyStatementMoverTest extends PyTestCase {
public void testNestedTry() { // PY-5192
doTest();
}
public void testClass() { // PY-5196
doTest();
}
}