fix: allow add breakpoints on large classes (#2672)

Large classes reach syntax highlighting limit and the editor
is switched to plain mode. We introduced new text/plaindebug
type that adds breakpoints panel even for plain documents.

Fixes #2672
This commit is contained in:
Jindra Petřík
2026-03-19 21:48:20 +01:00
parent 65737f9e31
commit cd8a9dbdad
5 changed files with 85 additions and 28 deletions

Binary file not shown.

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2008 Ayman Al-Sairafi ayman.alsairafi@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License
* at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jsyntaxpane.syntaxkits;
import jsyntaxpane.DefaultSyntaxKit;
import jsyntaxpane.lexers.EmptyLexer;
/**
*
* @author JPEXS
*/
public class PlainDebugSyntaxKit extends DefaultSyntaxKit {
public PlainDebugSyntaxKit() {
super(new EmptyLexer());
}
}

View File

@@ -24,6 +24,7 @@ text/xpath=jsyntaxpane.syntaxkits.XPathSyntaxKit
text/xhtml=jsyntaxpane.syntaxkits.XHTMLSyntaxKit
text/lua=jsyntaxpane.syntaxkits.LuaSyntaxKit
text/plain=jsyntaxpane.syntaxkits.PlainSyntaxKit
text/plaindebug=jsyntaxpane.syntaxkits.PlainDebugSyntaxKit
text/flasm3=jsyntaxpane.syntaxkits.Flasm3SyntaxKit
text/flasm3methodinfo=jsyntaxpane.syntaxkits.Flasm3MethodInfoSyntaxKit
text/flasm=jsyntaxpane.syntaxkits.FlasmSyntaxKit

View File

@@ -0,0 +1,19 @@
#
# Plain / Empty Document
#
Components = jsyntaxpane.components.LineNumbersBreakpointsRuler
PopupMenu = \
cut-to-clipboard , \
copy-to-clipboard , \
paste-from-clipboard , \
- , \
select-all , \
- , \
undo , \
redo , \
- , \
find , \
find-next , \
goto-line , \
- , \
complete-word

View File

@@ -88,37 +88,42 @@ public class UndoFixedEditorPane extends JEditorPane {
}
public void changeContentType(String type) {
if (!type.equals(getContentType())) {
removeDocumentListener();
Font oldFont = getFont();
setContentType(type);
setFont(oldFont);
addDocumentListener();
}
View.execInEventDispatch(new Runnable() {
@Override
public void run() {
if (!type.equals(getContentType())) {
removeDocumentListener();
Font oldFont = getFont();
setContentType(type);
setFont(oldFont);
addDocumentListener();
}
if (!Configuration.autoCloseQuotes.get()) {
getActionMap().remove("quotes");
KeyStroke ks = KeyStroke.getKeyStroke("typed '");
getInputMap(JTextComponent.WHEN_FOCUSED).remove(ks);
}
if (!Configuration.autoCloseQuotes.get()) {
getActionMap().remove("quotes");
KeyStroke ks = KeyStroke.getKeyStroke("typed '");
getInputMap(JTextComponent.WHEN_FOCUSED).remove(ks);
}
if (!Configuration.autoCloseDoubleQuotes.get()) {
getActionMap().remove("double-quotes");
KeyStroke ks = KeyStroke.getKeyStroke("typed \"");
getInputMap(JTextComponent.WHEN_FOCUSED).remove(ks);
}
if (!Configuration.autoCloseDoubleQuotes.get()) {
getActionMap().remove("double-quotes");
KeyStroke ks = KeyStroke.getKeyStroke("typed \"");
getInputMap(JTextComponent.WHEN_FOCUSED).remove(ks);
}
if (!Configuration.autoCloseBrackets.get()) {
getActionMap().remove("brackets");
KeyStroke ks = KeyStroke.getKeyStroke("typed [");
getInputMap(JTextComponent.WHEN_FOCUSED).remove(ks);
}
if (!Configuration.autoCloseBrackets.get()) {
getActionMap().remove("brackets");
KeyStroke ks = KeyStroke.getKeyStroke("typed [");
getInputMap(JTextComponent.WHEN_FOCUSED).remove(ks);
}
if (!Configuration.autoCloseParenthesis.get()) {
getActionMap().remove("parenthesis");
KeyStroke ks = KeyStroke.getKeyStroke("typed (");
getInputMap(JTextComponent.WHEN_FOCUSED).remove(ks);
}
if (!Configuration.autoCloseParenthesis.get()) {
getActionMap().remove("parenthesis");
KeyStroke ks = KeyStroke.getKeyStroke("typed (");
getInputMap(JTextComponent.WHEN_FOCUSED).remove(ks);
}
}
});
}
@Override
@@ -139,7 +144,11 @@ public class UndoFixedEditorPane extends JEditorPane {
if (!t.equals(getText())) {
boolean plain = t.length() > Configuration.syntaxHighlightLimit.get();
if (plain) {
contentType = "text/plain";
if (this instanceof DebuggableEditorPane) {
contentType = "text/plaindebug";
} else {
contentType = "text/plain";
}
originalContentType = getContentType();
changeContentType(contentType);
} else if (originalContentType != null) {