mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-10995 Wrapping on right margin deletes code with slashes at the end of miltiline statements.
If we didn't process auto-formatted events from document - document could be broken by replacement. Do not insert replacement string to the broken textrange
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
def do_stuff():
|
||||
another_long_variable = a_really_long_function_name_with_parameters(12,
|
||||
this_is_the_first_param=23,
|
||||
this_is_the_second=45).do_more_stuff_to_the_result()
|
||||
@@ -0,0 +1,3 @@
|
||||
def do_stuff():
|
||||
another_long_variable = a_really_long_function_name_with_parameters(12,
|
||||
<caret>this_is_the_first_param=23, this_is_the_second=45).do_more_stuff_to_the_result()
|
||||
@@ -49,6 +49,28 @@ public class PyWrapTest extends PyTestCase {
|
||||
doTest(" AND field");
|
||||
}
|
||||
|
||||
|
||||
public void testWrapRightMargin() {
|
||||
final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings();
|
||||
int oldValue = settings.RIGHT_MARGIN;
|
||||
boolean oldMarginValue = settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN;
|
||||
settings.RIGHT_MARGIN = 100;
|
||||
settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true;
|
||||
try {
|
||||
final String testName = "wrap/" + getTestName(true);
|
||||
myFixture.configureByFile(testName + ".py");
|
||||
for (int i = 0; i != 45; ++i) {
|
||||
myFixture.type(' ');
|
||||
}
|
||||
myFixture.checkResultByFile(testName + ".after.py");
|
||||
}
|
||||
finally {
|
||||
settings.RIGHT_MARGIN = oldValue;
|
||||
settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = oldMarginValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void doTest(final String textToType) {
|
||||
myFixture.configureByFile("wrap/" + getTestName(false) + ".py");
|
||||
myFixture.type(textToType);
|
||||
|
||||
Reference in New Issue
Block a user