Documentation for the Code

Textbox subclass for easier text manipulation, this module defines the following class:

  • Command: Textbox subclass. Improved word traversal.

How To Use This Module

(See the individual classes, methods, and attributes for details.)

  1. Import it: >>> import command_.

  2. Initialize command: >>> mycommand = command_.Command(...).

  3. Interact with command:

    a) Print command description: ``mycommand.print_description()``.
    
    b) Move cursor: ``mycommand.get_input_field().move(0, 0)``.
    
    c) Edit command in-place: ``mycommand.edit()``.
class command_.Command(item, box, input_field, tab_offset, *args, **kwargs)

Textbox subclass with methods for smooth text editing.

Command contains methods for simpler text formatting and string manipulation. Implemented standard - EMACS(?) shortcuts for word traversal and editing.

  • ALT_B: Back, left one word.
  • ALT_F: Forward, right one word.
  • CTRL_A: Beginning of the line (Home).
  • CTRL_B: Back one character.
  • CTRL_D: Delete.
  • CTRL_E: End of the line (End).
  • CTRL_F: Forward one character.
  • CTRL_H: Backspace.
  • CTRL_K: Cut line after cursor to clipboard.
  • CTRL_U: Cut line before cursor to clipboard.
  • CTRL_W: Cut word before cursor to clipboard.
  • CTRL_Y: Yank (paste). DSUSP, delayed suspend on BSD-based systems.
  • TAB: Cycle through command arguments.
  • SHIFT_TAB: Reverse cycle through command arguments.
do_command(ch)

Extend Textbox do_command method.

edit(validate=None)

Edit in the widget window and collect the results.

get_input_field()

Return input field. Used to control cursor.

print_description()

Print command description in main terminal window.

stdscr = None

Global, main terminal screen.

Project Versions

Table Of Contents

Previous topic

shearch

This Page