faster syntax highlighting

This commit is contained in:
honfika@gmail.com
2015-09-16 14:12:13 +02:00
parent 5e42c5b57c
commit e8fb8e2f37
41 changed files with 2129 additions and 2175 deletions

View File

@@ -123,12 +123,19 @@ public class UndoFixedEditorPane extends JEditorPane {
Stopwatch sw = Stopwatch.startNew();
try {
Document doc = getDocument();
setDocument(new SyntaxDocument(null));
doc.remove(0, doc.getLength());
Reader r = new StringReader(t);
EditorKit kit = createEditorKitForContentType(contentType);
Document doc = kit.createDefaultDocument();
if (doc instanceof SyntaxDocument) {
((SyntaxDocument) doc).setIgnoreUpdate(true);
}
kit.read(r, doc, 0);
if (doc instanceof SyntaxDocument) {
((SyntaxDocument) doc).setIgnoreUpdate(false);
}
setDocument(doc);
} catch (BadLocationException | IOException ex) {
Logger.getLogger(UndoFixedEditorPane.class.getName()).log(Level.SEVERE, null, ex);