Module: Plushie::Command::Text

Defined in:
lib/plushie/command/text.rb

Overview

Text input commands: selection and cursor movement.

All functions support window-qualified paths ("window#widget").

Examples:

Command::Text.select_all("main#email")
Command.select_all("email")  # also works via delegation

Class Method Summary collapse

Class Method Details

.move_cursor_to(widget_id, position) ⇒ Cmd

Move cursor to a specific position.

Parameters:

  • widget_id (String)
  • position (Integer)

Returns:



41
42
43
# File 'lib/plushie/command/text.rb', line 41

def move_cursor_to(widget_id, position)
  Command.widget_command(widget_id, "move_cursor_to", position)
end

.move_cursor_to_end(widget_id) ⇒ Cmd

Move cursor to the end.

Parameters:

  • widget_id (String)

Returns:



33
34
35
# File 'lib/plushie/command/text.rb', line 33

def move_cursor_to_end(widget_id)
  Command.widget_command(widget_id, "move_cursor_to_end")
end

.move_cursor_to_front(widget_id) ⇒ Cmd

Move cursor to the beginning.

Parameters:

  • widget_id (String)

Returns:



26
27
28
# File 'lib/plushie/command/text.rb', line 26

def move_cursor_to_front(widget_id)
  Command.widget_command(widget_id, "move_cursor_to_front")
end

.select_all(widget_id) ⇒ Cmd

Select all text in a text widget.

Parameters:

  • widget_id (String)

Returns:



19
20
21
# File 'lib/plushie/command/text.rb', line 19

def select_all(widget_id)
  Command.widget_command(widget_id, "select_all")
end

.select_range(widget_id, start_pos, end_pos) ⇒ Cmd

Select a range of text.

Parameters:

  • widget_id (String)
  • start_pos (Integer)
  • end_pos (Integer)

Returns:



50
51
52
# File 'lib/plushie/command/text.rb', line 50

def select_range(widget_id, start_pos, end_pos)
  Command.widget_command(widget_id, "select_range", {start_pos: start_pos, end_pos: end_pos})
end