diff --git a/python/src/com/jetbrains/python/codeInsight/editorActions/moveUpDown/StatementMover.java b/python/src/com/jetbrains/python/codeInsight/editorActions/moveUpDown/StatementMover.java index c0ffc5895b28..6da6cdef4086 100644 --- a/python/src/com/jetbrains/python/codeInsight/editorActions/moveUpDown/StatementMover.java +++ b/python/src/com/jetbrains/python/codeInsight/editorActions/moveUpDown/StatementMover.java @@ -59,7 +59,8 @@ public class StatementMover extends LineMover { // check if we want to move statement if (myStatementToMove == null) return false; //do not move pass statement - if (myStatementToMove instanceof PyPassStatement) { + if (myStatementToMove instanceof PyPassStatement || myStatementToMove instanceof PyBreakStatement + || myStatementToMove instanceof PyContinueStatement) { info.toMove2 = info.toMove; return true; } diff --git a/python/testData/mover/continueBreak.py b/python/testData/mover/continueBreak.py new file mode 100644 index 000000000000..4b7f77bf6878 --- /dev/null +++ b/python/testData/mover/continueBreak.py @@ -0,0 +1,4 @@ +test() +for item in range(10): + continue +test1() diff --git a/python/testData/mover/continueBreak_afterDown.py b/python/testData/mover/continueBreak_afterDown.py new file mode 100644 index 000000000000..6e8284429ef9 --- /dev/null +++ b/python/testData/mover/continueBreak_afterDown.py @@ -0,0 +1,4 @@ +test() +for item in range(10): + continue +test1() diff --git a/python/testData/mover/continueBreak_afterUp.py b/python/testData/mover/continueBreak_afterUp.py new file mode 100644 index 000000000000..a4c9223d4add --- /dev/null +++ b/python/testData/mover/continueBreak_afterUp.py @@ -0,0 +1,4 @@ +test() +for item in range(10): + continue +test1() diff --git a/python/testSrc/com/jetbrains/python/PyStatementMoverTest.java b/python/testSrc/com/jetbrains/python/PyStatementMoverTest.java index 70d754dd680b..ee74bc87d5f3 100644 --- a/python/testSrc/com/jetbrains/python/PyStatementMoverTest.java +++ b/python/testSrc/com/jetbrains/python/PyStatementMoverTest.java @@ -92,7 +92,11 @@ public class PyStatementMoverTest extends PyTestCase { doTest(); } - public void testFunctionDown() { + public void testFunctionDown() { // PY-5195 + doTest(); + } + + public void testContinueBreak() { // PY-5193 doTest(); } }