Class Line
java.lang.Object
org.aesh.readline.cursor.Line
A command line. This line abstract commands spread-out on multiple lines.
- Author:
- jdenise@redhat.com
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassMove to the index and Colorize the character.classA CursorAction is an action that modifies the cursor.classA cursor transaction runs action.classBuilder for CursorTransaction.classMove the cursor to a given index.classMove cursor backward.classMove cursor down.classMove cursor forward.classMove cursor up. -
Constructor Summary
ConstructorsConstructorDescriptionLine(Buffer buffer, Connection connection, int width) Creates a new Line instance representing a command line. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the character located at the cursor.chargetCharacterAtPosition(int position) Returns the character at an arbitrary positionintGets the index of the character where the cursor is located.Gets the cursor locator for this line's buffer.Returns a string from the the cursor position to the end of the line.Returns a string from the beginning of the line to the cursor.Build a new builder.toString()
-
Constructor Details
-
Line
Creates a new Line instance representing a command line.- Parameters:
buffer- the buffer containing the line contentconnection- the terminal connection for cursor operationswidth- the terminal width in characters
-
-
Method Details
-
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
-
newCursorTransactionBuilder
Build a new builder.- Returns:
- The builder.
-
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
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
-