mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-18522 Don't paste text before the line if it's only spaces and caret is at the end of line
This commit is contained in:
@@ -186,13 +186,15 @@ public class PythonCopyPasteProcessor implements CopyPastePreProcessor {
|
||||
}
|
||||
|
||||
private static boolean isApplicable(@NotNull final PsiFile file, @NotNull String text, int caretOffset) {
|
||||
final boolean useTabs =
|
||||
CodeStyleSettingsManager.getSettings(file.getProject()).useTabCharacter(PythonFileType.INSTANCE);
|
||||
final boolean useTabs = CodeStyleSettingsManager.getSettings(file.getProject()).useTabCharacter(PythonFileType.INSTANCE);
|
||||
final PsiElement nonWS = PyUtil.findNextAtOffset(file, caretOffset, PsiWhiteSpace.class);
|
||||
if (nonWS == null || text.endsWith("\n"))
|
||||
return true;
|
||||
if (inStatementList(file, caretOffset) && (text.startsWith(useTabs ? "\t" : " ") || StringUtil.split(text, "\n").size() > 1))
|
||||
if (nonWS == null) {
|
||||
return !StringUtil.isEmptyOrSpaces(text);
|
||||
}
|
||||
if (text.endsWith("\n") ||
|
||||
(inStatementList(file, caretOffset) && (text.startsWith(useTabs ? "\t" : " ") || StringUtil.split(text, "\n").size() > 1))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user