Folding for XML no longer working (v3.3.3)
earlhood opened this issue · comments
Description
I upgraded from v3.2.0 to v3.3.3, where RSyntaxTextArea is being used to edit XML files. After the upgrade, folding indicators are no longer present. No changes to code. Relevant fragment:
sourceTextEditor.setSyntaxEditingStyle(
org.fife.ui.rsyntaxtextarea.SyntaxConstants.SYNTAX_STYLE_XML);
sourceTextEditor.setCodeFoldingEnabled(true);
editorScrollPane.setLineNumbersEnabled(true);
In case it matters, I also load the 'idea' theme as follows:
try {
String rstaThemePath =
"/org/fife/ui/rsyntaxtextarea/themes/"+name+".xml";
in = getClass().getResourceAsStream(rstaThemePath);
if (in != null) {
org.fife.ui.rsyntaxtextarea.Theme theme =
org.fife.ui.rsyntaxtextarea.Theme.load(in);
theme.apply(sourceTextEditor);
} else {
log.warn("Theme '"+name+"' not recognized");
}
} catch (java.io.IOException ioe) {
log.error("Error loading editor theme: "+ioe.getLocalizedMessage(), ioe);
} finally {
IOUtil.closeQuietly(in);
}
Also worth noting that the Gutter width is not auto-resizing to fit line numbers, but this problem also occurs in v3.2.0, hence the primary reason of trying to upgrade.
Java version
OpenJDK 11.0.11.9-hotspot
I just noticed that fold indicators only show when mousing into the gutter, where only a persistent indicator is provided if an element is collapsed. Digging thru the javadoc, I discovered I have to add the following to get prior behavior:
editorScrollPane.getGutter().setFoldIndicatorStyle(
org.fife.ui.rtextarea.FoldIndicatorStyle.CLASSIC);
Note, there is still problem with gutter not sizing to show complete line number when there are over 100 lines. I shall submit a separate bug item for this (or am I missing some API call to get the correct sizing?)
Hi @earlhood - this should work out of the box. Please open a ticket for it!
And yes, I recently changed the fold indicator style and made it configurable, even though I prefer the “classic” style because I’m old 😀
Here are the relevant release notes: https://github.com/bobbylight/RSyntaxTextArea/releases/tag/3.3.0