Painting over the Editor

I have a plugin that searches for text in the Editor. I am using MarkupModel.addRangeHighlighter(...) with a CustomHighlightRenderer to paint highlights in the Editor. The advantage of using a CustomHighlightRenderer is that all highlights are uniformly "bound" to the editor text, so scrolling is smooth and seamless (and all locations can be painted at once). However there are some components that need to be painted over the editor text, which I am doing via Graphics2D separately, by laying a new component on top of the Editor's contentComponent. I would like to use a CustomHighlightRenderer for these components as well (since they are visually attached to highlights), but unfortunately they need to be painted over, rather than under the Editor text.

Is it possible to paint over the editor text, covering the entire region like RangeHighlighter, so that scrolling is smooth and seamless? I would like to avoid listening for scrolling updates and repainting, which is slow and glitchy. Thanks!

0
3 comments

It's not possible currently.

I wonder why you need to track scrolling in your current approach. If a component is added directly as a child of editor's content component, it will be scrolled with it automatically. Processing of other events (document, folding, etc) will be required though to keep it in sync.

1
Avatar
Breandan Considine

You're right, the scrolling behavior was implementation related, but it needed to be updated for editor related events. How can I paint over the sidebar gutter (where the line numbers are displayed)? Is there a parent component of the editor content and the sidebar?

0
Avatar
Breandan Considine

Never mind, just found the component

 the component for the entire editor including the scrollbars, error stripe, gutter and other decorations.
0

Please sign in to leave a comment.