PY-15564 Remove text after the first backslash inside whitespace during line joining

This commit is contained in:
Mikhail Golubev
2015-04-16 15:41:56 +03:00
parent c11c02f926
commit e104a7c8fd
6 changed files with 22 additions and 0 deletions
@@ -119,6 +119,12 @@ public class PyJoinLinesHandler implements JoinRawLinesHandlerDelegate {
}
}
}
final String sequence = text.subSequence(i + 1, end).toString();
final int index = sequence.indexOf('\\');
if (index >= 0) {
document.replaceString(i + 1, end, sequence.substring(0, index));
return i + 1 + index;
}
return CANNOT_JOIN;
}
@@ -0,0 +1 @@
from foo import bar, baz
@@ -0,0 +1,2 @@
from foo import bar, \
baz
@@ -0,0 +1 @@
import foo, bar
@@ -0,0 +1,2 @@
import foo, \
bar
@@ -138,4 +138,14 @@ public class PyJoinLinesTest extends PyTestCase {
public void testListComprehension() {
doTest();
}
// PY-15564
public void testBackslashBetweenTargetsInImport() {
doTest();
}
// PY-15564
public void testBackslashBetweenTargetsInFromImport() {
doTest();
}
}