Class: RatatuiRuby::Widgets::Cursor
- Inherits:
-
Object
- Object
- RatatuiRuby::Widgets::Cursor
- Includes:
- CoerceableWidget
- Defined in:
- lib/ratatui_ruby/widgets/cursor.rb
Overview
Controls the terminal cursor position.
Interfaces are not just output; they require input. Users need a visual cue—a blinking block or line—to know where their keystrokes will appear.
This widget renders a ghost. It does not draw a character but instructs the terminal to place the hardware cursor at specific coordinates.
Use it for text editors, input fields, or command prompts.
Examples
– SPDX-SnippetBegin SPDX-FileCopyrightText: 2026 Kerrick Long SPDX-License-Identifier: MIT-0 ++
Cursor.new(x: 10, y: 5)
– SPDX-SnippetEnd ++ See also:
-
RatatuiRuby::Frame#set_cursor_position (Frame API alternative)
Instance Method Summary collapse
-
#initialize(x:, y:) ⇒ Cursor
constructor
Creates a new Cursor.
Methods included from CoerceableWidget
Constructor Details
#initialize(x:, y:) ⇒ Cursor
Creates a new Cursor.
- x
-
Integer.
- y
-
Integer.
49 50 51 |
# File 'lib/ratatui_ruby/widgets/cursor.rb', line 49 def initialize(x:, y:) super(x: Integer(x), y: Integer(y)) end |