struct Athena::Console::Cursor
inherits Struct
#
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#
Methods#
#clear_output : self
#
Clears the output from the cursors' current position to the end of the screen.
#current_position : ::Tuple(Int32, Int32)
#
Returns the current column, row position of the cursor.
#move_to_position(column : Int32, row : Int32) : self
#
Moves the cursor to the provided column, row position.
#save_position : self
#
Saves the current position such that it could be restored via #restore_position
.