class
Opal::Input::TextInput
- Opal::Input::TextInput
- Reference
- Object
Overview
Interactive single-line text input field supporting Tab completion, ghost text preview, cursor navigation, and history.
Defined in:
opal/input/text_input.crConstructors
Instance Method Summary
-
#accept_autocomplete : Bool
Accepts the currently visible ghost text suggestion
- #autocomplete : Autocomplete | Nil
-
#autocomplete(&block : Autocomplete -> Nil) : self
Configures autocomplete using a block DSL
- #autocomplete=(autocomplete : Autocomplete | Nil)
-
#current_ghost_text : String | Nil
Current ghost text preview suffix
- #cursor_pos : Int32
- #cursor_pos=(cursor_pos : Int32)
-
#delete_backward : Nil
Deletes the character immediately preceding the cursor
-
#delete_forward : Nil
Deletes the character at the cursor
-
#handle_key(event : Terminal::KeyEvent) : Bool
Handles a key event.
- #history : Array(String)
- #history=(history : Array(String))
-
#insert(ch : Char) : Nil
Inserts a character at the current cursor position
- #move_end : Nil
-
#move_left : Nil
Moves cursor left
-
#move_right : Nil
Moves cursor right
- #move_start : Nil
- #prompt : String
- #prompt=(prompt : String)
-
#read_line(driver : Terminal::Driver | Nil = nil) : String
Interactively reads user input until Enter is pressed, drawing in-place updates and ghost text.
- #value : String
- #value=(value : String)
Constructor Detail
Instance Method Detail
Configures autocomplete using a block DSL
Handles a key event. Returns true if Enter was pressed (submission), false otherwise.
Interactively reads user input until Enter is pressed, drawing in-place updates and ghost text.