Class CursorLocator
java.lang.Object
org.aesh.readline.cursor.CursorLocator
Map a command character index onto a cursor COL/ROW.
- Author:
- jdenise@redhat.com
-
Constructor Summary
ConstructorsConstructorDescriptionCursorLocator(Buffer buffer) Creates a new cursor locator for the specified buffer. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLine(int size, int promptSize) Adds a line with the specified size and prompt size to the locator.voidclear()Clears all stored line information from the locator.voidMarks the cursor location as invalidated.booleanChecks if the cursor location tracking has been invalidated.locate(int index, int width) The core logic of the locator.
-
Constructor Details
-
CursorLocator
Creates a new cursor locator for the specified buffer.- Parameters:
buffer- the buffer to track cursor positions for
-
-
Method Details
-
addLine
public void addLine(int size, int promptSize) Adds a line with the specified size and prompt size to the locator.- Parameters:
size- the size of the line contentpromptSize- the size of the prompt on this line
-
isLocationInvalidated
public boolean isLocationInvalidated()Checks if the cursor location tracking has been invalidated.- Returns:
- true if the location is invalidated, false otherwise
-
invalidateCursorLocation
public void invalidateCursorLocation()Marks the cursor location as invalidated. This typically happens when the terminal state changes in a way that makes the stored line information unreliable. -
locate
The core logic of the locator. Map a command index onto an absolute COL/ROW cursor location.- Parameters:
index- The commnd index.width- The terminal width.- Returns:
- the cursor location corresponding to the index, or null if the location is invalidated or out of bounds
-
clear
public void clear()Clears all stored line information from the locator.
-