Skip to content

Commit

Permalink
Highlighter impl.: change some fields visibilities to simplify classe…
Browse files Browse the repository at this point in the history
…s extensions
  • Loading branch information
mattirn committed Apr 1, 2021
1 parent 3320df5 commit 8e66a60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@
*/
public class SystemHighlighter extends DefaultHighlighter {
private final static StyleResolver resolver = Styles.lsStyle();
private final SyntaxHighlighter commandHighlighter;
private final SyntaxHighlighter argsHighlighter;
private final SyntaxHighlighter langHighlighter;
private final SystemRegistry systemRegistry;
private final Set<String> fileHighlight = new HashSet<>();
private Pattern errorPattern;
private int errorIndex = -1;
protected final SyntaxHighlighter commandHighlighter;
protected final SyntaxHighlighter argsHighlighter;
protected final SyntaxHighlighter langHighlighter;
protected final SystemRegistry systemRegistry;
protected final Set<String> fileHighlight = new HashSet<>();

public SystemHighlighter(SyntaxHighlighter commandHighlighter, SyntaxHighlighter argsHighlighter
, SyntaxHighlighter langHighlighter) {
Expand All @@ -50,18 +48,6 @@ public SystemHighlighter(SyntaxHighlighter commandHighlighter, SyntaxHighlighter
this.systemRegistry = SystemRegistry.get();
}

@Override
public void setErrorPattern(Pattern errorPattern) {
this.errorPattern = errorPattern;
super.setErrorPattern(errorPattern);
}

@Override
public void setErrorIndex(int errorIndex) {
this.errorIndex = errorIndex;
super.setErrorIndex(errorIndex);
}

@Override
public AttributedString highlight(LineReader reader, String buffer) {
return doDefaultHighlight(reader) ? super.highlight(reader, buffer) : systemHighlight(reader, buffer);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2019, the original author or authors.
* Copyright (c) 2002-2021, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand All @@ -19,8 +19,8 @@
import org.jline.utils.WCWidth;

public class DefaultHighlighter implements Highlighter {
private Pattern errorPattern;
private int errorIndex = -1;
protected Pattern errorPattern;
protected int errorIndex = -1;

@Override
public void setErrorPattern(Pattern errorPattern) {
Expand Down

0 comments on commit 8e66a60

Please sign in to comment.