Fixed: #2476 Dark interface skins identifiers highlighter visibility

This commit is contained in:
Jindra Petřík
2025-06-27 19:09:33 +02:00
parent ed2180719a
commit 48dea51c94
8 changed files with 61 additions and 3 deletions

View File

@@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file.
## [Unreleased]
### Fixed
- [#2476] Dark interface skins identifiers highlighter visibility
## [24.0.0] - 2025-06-24
### Added
@@ -3869,6 +3871,7 @@ Major version of SWF to XML export changed to 2.
[alpha 9]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha8...alpha9
[alpha 8]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha7...alpha8
[alpha 7]: https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/alpha7
[#2476]: https://www.free-decompiler.com/flash/issues/2476
[#2404]: https://www.free-decompiler.com/flash/issues/2404
[#1418]: https://www.free-decompiler.com/flash/issues/1418
[#289]: https://www.free-decompiler.com/flash/issues/289

Binary file not shown.

View File

@@ -18,6 +18,7 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import jsyntaxpane.actions.*;
import javax.swing.JEditorPane;
import javax.swing.UIManager;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.text.JTextComponent;
@@ -67,6 +68,12 @@ public class PairsMarker implements CaretListener, SyntaxComponent, PropertyChan
@Override
public void config(Configuration config) {
Color markerColor = config.getColor(PROPERTY_COLOR, new Color(0xeeee33));
Color editorBackground = UIManager.getColor("EditorPane.background");
int light = (editorBackground.getRed() + editorBackground.getGreen() + editorBackground.getBlue()) / 3;
if (light < 128) {
markerColor = new Color(0x553322);
}
this.marker = new Markers.SimpleMarker(markerColor);
}

View File

@@ -22,6 +22,7 @@ import java.util.Iterator;
import java.util.Set;
import java.util.logging.Logger;
import javax.swing.JEditorPane;
import javax.swing.UIManager;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import jsyntaxpane.SyntaxDocument;
@@ -101,6 +102,11 @@ public class TokenMarker implements SyntaxComponent, CaretListener, PropertyChan
public void config(Configuration config) {
Color markerColor = config.getColor(
PROPERTY_COLOR, DEFAULT_COLOR);
Color editorBackground = UIManager.getColor("EditorPane.background");
int light = (editorBackground.getRed() + editorBackground.getGreen() + editorBackground.getBlue()) / 3;
if (light < 128) {
markerColor = new Color(0x553322);
}
this.marker = new Markers.SimpleMarker(markerColor);
String types = config.getString(
PROPERTY_TOKENTYPES, DEFAULT_TOKENTYPES);

View File

@@ -18,6 +18,7 @@ import jsyntaxpane.*;
import java.io.IOException;
import java.io.Reader;
import java.util.List;
import java.util.Stack;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.text.Segment;
@@ -33,6 +34,8 @@ public abstract class DefaultJFlexLexer implements Lexer {
protected int tokenStart;
protected int tokenLength;
protected int offset;
protected Stack<Token> pushedBack = new Stack<>();
/**
* Helper method to create and return a new Token from of TokenType
@@ -100,7 +103,7 @@ public abstract class DefaultJFlexLexer implements Lexer {
CharArrayReader reader = new CharArrayReader(segment.array, segment.offset, segment.count);
yyreset(reader);
this.offset = ofst;
for (Token t = yylex(); t != null; t = yylex()) {
for (Token t = lex(); t != null; t = lex()) {
tokens.add(t);
}
} catch (IOException ex) {
@@ -115,6 +118,29 @@ public abstract class DefaultJFlexLexer implements Lexer {
*/
public abstract void yyreset(Reader reader);
/**
* JPEXS:
* Pushes back token.
* @param token
*/
public void pushBack(Token token) {
pushedBack.push(token);
}
/**
* JPEXS:
* Calls yylex, allows pushback
* @return
* @throws java.io.IOException
*/
public Token lex() throws java.io.IOException {
if (!pushedBack.isEmpty()) {
return pushedBack.pop();
}
return yylex();
}
/**
* This is called to return the next Token from the Input Reader
* @return next token, or null if no more tokens.

View File

@@ -83,7 +83,7 @@ StringCharacter = [^\r\n\"\\]
Register= register{NumberLiteral}
Constant= constant{NumberLiteral}
%state STRING,PARAMETERS
%state STRING,IDENT,PARAMETERS
%%
@@ -94,6 +94,7 @@ Constant= constant{NumberLiteral}
{WhiteSpace} { }
{Label} {
pushBack(token(TokenType.OPERATOR,yychar+yylength()-1,1));
return token(TokenType.IDENTIFIER,yychar,yylength()-1);
}
@@ -113,6 +114,9 @@ Constant= constant{NumberLiteral}
tokenLength = 1;
}
/* operator*/
"," { return token(TokenType.OPERATOR);}
/* numeric literals */
{NumberLiteral} { return token(TokenType.NUMBER); }

View File

@@ -103,7 +103,10 @@ ExceptionTarget = "exceptiontarget "{PositiveNumberLiteral}":"
}
{Label} {return token(TokenType.IDENTIFIER,yychar,yylength()-1); }
{Label} {
pushBack(token(TokenType.OPERATOR,yychar+yylength()-1,1));
return token(TokenType.IDENTIFIER,yychar,yylength()-1);
}

View File

@@ -79,6 +79,7 @@ import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.event.DocumentEvent;
@@ -476,6 +477,14 @@ public class VariableMarker implements SyntaxComponent, CaretListener, PropertyC
public void config(Configuration config) {
Color markerColor = config.getColor(PROPERTY_COLOR, DEFAULT_COLOR);
Color errorColor = config.getColor(PROPERTY_ERRORCOLOR, DEFAULT_ERRORCOLOR);
Color editorBackground = UIManager.getColor("EditorPane.background");
int light = (editorBackground.getRed() + editorBackground.getGreen() + editorBackground.getBlue()) / 3;
if (light < 128) {
markerColor = new Color(0x443322);
}
this.marker = new OccurencesMarker(markerColor);
this.errorMarker = new WavyUnderLinePainter(errorColor); //Markers.SimpleMarker(errorColor);
String types = config.getString(