From 93035db9e1bb399fc1b22ab103e470e504c8453e Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Mon, 9 Jul 2018 18:21:06 +0300 Subject: [PATCH] make Inlay.updateSize() imply Inlay.repaint() otherwise clients would always need to call the latter after the former --- .../src/com/intellij/openapi/editor/Inlay.java | 3 ++- .../daemon/impl/ParameterHintsPresentationManager.java | 1 - .../src/com/intellij/openapi/editor/impl/InlayImpl.java | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/Inlay.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/Inlay.java index f45c73fc3724..60e3342762c0 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/Inlay.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/Inlay.java @@ -58,9 +58,10 @@ public interface Inlay extends Disposable, UserDataHolderEx { int getWidthInPixels(); /** - * Updates inlay's size by querying information from inlay's renderer. + * Updates inlay's size by querying information from inlay's renderer. Also, repaint the inlay. * * @see EditorCustomElementRenderer#calcWidthInPixels(Editor) + * @see #repaint() */ void updateSize(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ParameterHintsPresentationManager.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ParameterHintsPresentationManager.java index 3280d7eaed8e..f5e222f64c79 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ParameterHintsPresentationManager.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ParameterHintsPresentationManager.java @@ -105,7 +105,6 @@ public class ParameterHintsPresentationManager implements Disposable { MyRenderer renderer = (MyRenderer)hint.getRenderer(); renderer.update(editor, newText, useAnimation); hint.updateSize(); - hint.repaint(); if (useAnimation) scheduleRendererUpdate(editor, hint); } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/InlayImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/InlayImpl.java index 4d4589fbf1a6..539fc9a6d3ee 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/InlayImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/InlayImpl.java @@ -38,7 +38,12 @@ class InlayImpl extends RangeMarkerImpl implements Inlay, Getter { public void updateSize() { int oldWidth = myWidthInPixels; doUpdateSize(); - if (oldWidth != myWidthInPixels) myEditor.getInlayModel().notifyChanged(this); + if (oldWidth != myWidthInPixels) { + myEditor.getInlayModel().notifyChanged(this); + } + else { + repaint(); + } } @Override