Athena::Console::Cursor
Inherits Struct / Value / Object
Provides an OO way to interact with the console window, allows writing on any position of the output.
@[ACONA::AsCommand("cursor")]
class CursorCommand < ACON::Command
protected def execute(input : ACON::Input::Interface, output : ACON::Output::Interface) : ACON::Command::Status
cursor = ACON::Cursor.new output
# Move the cursor to a specific column, row position.
cursor.move_to_position 50, 3
# Write text at that location.
output.puts "Hello!"
# Clear the current line.
cursor.clear_line
ACON::Command::Status::SUCCESS
end
end
Constructors
new(output : ACON::Output::Interface, input : IO = STDIN)
SourceInstance methods
move_to_position(column : Int32, row : Int32) : self
Moves the cursor to the provided column, row position.
save_position
Saves the current position such that it could be restored via #restore_position.