mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-104500 Gradle: Allow to reuse common logic for other external systems
Correct editor painting in case when it contains only collapsed fold region (used to draw empty area because selection foreground for the standard colors scheme is the same as default background and selection background was not painted because of too restrictive 'if' condition)
This commit is contained in:
+14
-2
@@ -49,12 +49,24 @@ public class ExternalProjectPathLookupElement extends LookupElement {
|
||||
@Override
|
||||
public void handleInsert(InsertionContext context) {
|
||||
Editor editor = context.getEditor();
|
||||
final FoldingModel foldingModel = editor.getFoldingModel();
|
||||
foldingModel.runBatchFoldingOperation(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FoldRegion[] regions = foldingModel.getAllFoldRegions();
|
||||
for (FoldRegion region : regions) {
|
||||
foldingModel.removeFoldRegion(region);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final Document document = editor.getDocument();
|
||||
final int startOffset = context.getStartOffset();
|
||||
document.replaceString(startOffset, context.getTailOffset(), myProjectPath);
|
||||
|
||||
document.replaceString(startOffset, document.getTextLength(), myProjectPath);
|
||||
final Project project = context.getProject();
|
||||
PsiDocumentManager.getInstance(project).commitDocument(document);
|
||||
final FoldingModel foldingModel = editor.getFoldingModel();
|
||||
|
||||
foldingModel.runBatchFoldingOperationDoNotCollapseCaret(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -2199,7 +2199,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
|
||||
if (hEnd >= lEnd) {
|
||||
FoldRegion collapsedFolderAt = myFoldingModel.getCollapsedRegionAtOffset(start);
|
||||
if (collapsedFolderAt == null) {
|
||||
if (collapsedFolderAt == null || collapsedFolderAt.getEndOffset() == lEnd) {
|
||||
position.x = drawSoftWrapAwareBackground(g, backColor, text, start, lEnd - lIterator.getSeparatorLength(), position, fontType,
|
||||
defaultBackground, clip, softWrapsToSkip, caretRowPainted);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user