mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-5058 When unicode/raw string literals are line-split, the u/r/ur prefix is missing
This commit is contained in:
@@ -101,8 +101,9 @@ public class PythonEnterHandler extends EnterHandlerDelegateAdapter {
|
||||
return Result.Continue;
|
||||
}
|
||||
if ("\\".equals(doc.getText(TextRange.create(offset - 1, offset)))) return Result.Continue;
|
||||
String pref = element.getText().substring(0, prefixLength);
|
||||
String quote = element.getText().substring(prefixLength, prefixLength + 1);
|
||||
doc.insertString(offset, quote + " \\" + quote);
|
||||
doc.insertString(offset, quote + " \\" + pref + quote);
|
||||
caretOffset.set(caretOffset.get() + 3);
|
||||
return Result.Continue;
|
||||
}
|
||||
|
||||
@@ -102,6 +102,11 @@ public class PyEditingTest extends PyTestCase {
|
||||
doTestEnter("# foo <caret>bar", "# foo \n# bar");
|
||||
}
|
||||
|
||||
public void testEnterInPrefixString() { // PY-5058
|
||||
doTestEnter("s = r'some <caret>string'", "s = r'some ' \\\n" +
|
||||
" r'string'");
|
||||
}
|
||||
|
||||
public void testEnterInStatement() {
|
||||
doTestEnter("if a <caret>and b: pass", "if a \\\nand b: pass");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user