Class CursorSupport

java.lang.Object
org.jline.terminal.impl.CursorSupport

public class CursorSupport extends Object
Utility class for cursor position detection in terminals.

The CursorSupport class provides functionality for determining the current cursor position in a terminal. It uses terminal capabilities to request the cursor position from the terminal and parse the response.

This class is used internally by terminal implementations to implement the Terminal.getCursorPosition(IntConsumer) method. It relies on specific terminal capabilities (user6 and user7) that define the sequence to request the cursor position and the format of the response.

The cursor position detection works by:

  1. Sending a special escape sequence to the terminal (defined by user7 capability)
  2. Reading the terminal's response
  3. Parsing the response using a pattern derived from the user6 capability
  4. Extracting the row and column coordinates from the parsed response

Note that cursor position reporting is not supported by all terminals, and this method may return null if the terminal does not support this feature or if an error occurs during the detection process.

See Also: