Package org.daiitech.naftah.utils.script
Class NaftahHighlighter
java.lang.Object
org.daiitech.naftah.utils.repl.BaseHighlighter
org.daiitech.naftah.utils.script.NaftahHighlighter
- All Implemented Interfaces:
org.jline.reader.Highlighter
A highlighter implementation that reshapes text for correct display.
Extends BaseHighlighter to wrap an original highlighter and
applies text shaping on the input buffer if needed.
The highlighting process checks if reshaping is required and if the input contains characters. If so, it reshapes the text for proper visual representation, then merges the reshaped text style with the original highlight styles.
- Author:
- Chakib Daii
-
Field Summary
Fields inherited from class org.daiitech.naftah.utils.repl.BaseHighlighter
originalHighlighter -
Constructor Summary
ConstructorsConstructorDescriptionNaftahHighlighter(org.jline.reader.Highlighter originalHighlighter) Constructs an NaftahHighlighter wrapping the specified original highlighter. -
Method Summary
Methods inherited from class org.daiitech.naftah.utils.repl.BaseHighlighter
merge, setErrorIndex, setErrorPatternMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jline.reader.Highlighter
refresh
-
Constructor Details
-
NaftahHighlighter
public NaftahHighlighter(org.jline.reader.Highlighter originalHighlighter) Constructs an NaftahHighlighter wrapping the specified original highlighter.- Parameters:
originalHighlighter- the underlying highlighter to delegate to
-
-
Method Details
-
highlight
public org.jline.utils.AttributedString highlight(org.jline.reader.LineReader reader, String buffer) Highlights the input buffer, reshaping text if applicable.- Specified by:
highlightin interfaceorg.jline.reader.Highlighter- Overrides:
highlightin classBaseHighlighter- Parameters:
reader- theLineReaderused for reading inputbuffer- the input text to be highlighted- Returns:
- an
AttributedStringrepresenting the highlighted and reshaped text
-