Class NaftahHighlighter

java.lang.Object
org.daiitech.naftah.utils.repl.BaseHighlighter
org.daiitech.naftah.utils.script.NaftahHighlighter
All Implemented Interfaces:
org.jline.reader.Highlighter

public class NaftahHighlighter extends BaseHighlighter
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
  • 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:
      highlight in interface org.jline.reader.Highlighter
      Overrides:
      highlight in class BaseHighlighter
      Parameters:
      reader - the LineReader used for reading input
      buffer - the input text to be highlighted
      Returns:
      an AttributedString representing the highlighted and reshaped text