LLM-362: Refactor EmptySoftWrapPainter to make it platform

GitOrigin-RevId: c65c841ed2bbdd22b99056839e684bdae00dae47
This commit is contained in:
Vladislav Kuznetsov
2024-09-23 18:55:45 +04:00
committed by intellij-monorepo-bot
parent fb4f00898d
commit d4fc023f6b
5 changed files with 24 additions and 20 deletions

View File

@@ -1,17 +0,0 @@
package com.intellij.notebooks.visualization.r.inlays.components
import com.intellij.openapi.editor.impl.softwrap.SoftWrapDrawingType
import com.intellij.openapi.editor.impl.softwrap.SoftWrapPainter
import java.awt.Graphics
object EmptySoftWrapPainter : SoftWrapPainter {
override fun paint(g: Graphics, drawingType: SoftWrapDrawingType, x: Int, y: Int, lineHeight: Int) = 0
override fun getDrawingHorizontalOffset(g: Graphics, drawingType: SoftWrapDrawingType, x: Int, y: Int, lineHeight: Int) = 0
override fun getMinDrawingWidth(drawingType: SoftWrapDrawingType) = 0
override fun canUse() = true
override fun reinit() {}
}

View File

@@ -8220,7 +8220,6 @@ f:com.intellij.openapi.editor.impl.SoftWrapModelImpl
- paint(java.awt.Graphics,com.intellij.openapi.editor.impl.softwrap.SoftWrapDrawingType,I,I,I):I
- propertyChange(java.beans.PropertyChangeEvent):V
- release():V
- setSoftWrapPainter(com.intellij.openapi.editor.impl.softwrap.SoftWrapPainter):V
com.intellij.openapi.editor.impl.TextDrawingCallback
- a:drawChars(java.awt.Graphics,C[],I,I,I,I,java.awt.Color,com.intellij.openapi.editor.impl.FontInfo):V
f:com.intellij.openapi.editor.impl.TrailingSpacesStripper

View File

@@ -613,10 +613,12 @@ public final class SoftWrapModelImpl extends InlayModel.SimpleAdapter
return applianceManager;
}
@TestOnly
@ApiStatus.Internal
@ApiStatus.Experimental
public void setSoftWrapPainter(SoftWrapPainter painter) {
myPainter = painter;
applianceManager.setSoftWrapPainter(painter);
reinitSettings();
}
@Override

View File

@@ -0,0 +1,19 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.editor.impl.softwrap
import org.jetbrains.annotations.ApiStatus
import java.awt.Graphics
@ApiStatus.Internal
@ApiStatus.Experimental
object EmptySoftWrapPainter : SoftWrapPainter {
override fun paint(g: Graphics, drawingType: SoftWrapDrawingType, x: Int, y: Int, lineHeight: Int): Int = 0
override fun getDrawingHorizontalOffset(g: Graphics, drawingType: SoftWrapDrawingType, x: Int, y: Int, lineHeight: Int): Int = 0
override fun getMinDrawingWidth(drawingType: SoftWrapDrawingType): Int = 0
override fun canUse(): Boolean = true
override fun reinit() {}
}

View File

@@ -473,9 +473,10 @@ public final class SoftWrapApplianceManager implements Dumpable {
}
@ApiStatus.Internal
@TestOnly
@ApiStatus.Experimental
public void setSoftWrapPainter(SoftWrapPainter painter) {
myPainter = painter;
recalculateAll();
}
@ApiStatus.Internal