Class Line

java.lang.Object
org.aesh.readline.cursor.Line

public class Line extends Object
A command line. This line abstract commands spread-out on multiple lines.
Author:
jdenise@redhat.com
  • Constructor Details

    • Line

      public Line(Buffer buffer, Connection connection, int width)
      Creates a new Line instance representing a command line.
      Parameters:
      buffer - the buffer containing the line content
      connection - the terminal connection for cursor operations
      width - the terminal width in characters
  • Method Details

    • getLineFromCursor

      public String getLineFromCursor()
      Returns a string from the the cursor position to the end of the line. Takes into account multiple lines.
      Returns:
      the substring from the cursor position to the end of the line
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • newCursorTransactionBuilder

      public Line.CursorTransactionBuilder newCursorTransactionBuilder()
      Build a new builder.
      Returns:
      The builder.
    • getCursorLocator

      public CursorLocator getCursorLocator()
      Gets the cursor locator for this line's buffer.
      Returns:
      the cursor locator
    • getCurrentCharacterIndex

      public int getCurrentCharacterIndex()
      Gets the index of the character where the cursor is located.
      Returns:
      The selected character index.
    • getLineToCursor

      public String getLineToCursor()
      Returns a string from the beginning of the line to the cursor. Takes into account multiple lines.
      Returns:
      the contents of the beginning of the line up to where the cursor is
    • getCharacterAtCursor

      public int getCharacterAtCursor()
      Returns the character located at the cursor.
      Returns:
      The character.
    • getCharacterAtPosition

      public char getCharacterAtPosition(int position)
      Returns the character at an arbitrary position
      Parameters:
      position - the position which a character is
      Returns:
      the character at the given position