bobbylight / RSyntaxTextArea

A syntax highlighting, code folding text editor for Java Swing applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add an image in the middle of the text

gvom opened this issue · comments

Hello!

I would like to add a image in the middle of the code text. To allow the user to know with what image he is working.
Like this:

image

I already tried to do it this way, but it didn't work:

final SimpleAttributeSet attrs = new SimpleAttributeSet(doc.getParagraphElement(doc.getLength()).getAttributes());
if (StyleConstants.getIcon(attrs) == null) {
StyleConstants.setIcon(attrs, new ImageIcon(imgFile.getAbsolutePath()));
}

if("#{image:".equals(label)) {
identation = UIUtils.getIdentationToNextLine(textSourceCode);
doc.insertString(doc.getLength()-1, identation, attrs);
}else
doc.insertString(doc.getLength(), " ", attrs);

I cannot find a way to do this, if is possible, can you point me the righ way? If is not possible can you add this new feature?

RSTA will never support embedding arbitrary images in its text content, but it can render emojis if the fonts being used support them. In such cases, they are rendered if the appropriate code point is in the content.