UI
NAME
Terminal::UI -- A framework for building terminal interfaces
DESCRIPTION
Terminal::UI is a framework for building user interfaces in the terminal.
This class provides routines for manipulating:
a screen: the top level object representing the screen
frames: borders around content
panes: scrolling regions with content
style: a global style
input: input routines
These are documented in Terminal::UI::Screen, Frame, Pane, Style, and Input respectively.
ATTRIBUTES
$!focused-frame (Terminal::UI::Frame)
The currently focused frame.
$!input (Terminal::UI::Input)
The object for getting input.
Handles: get-key
$!interacting (Bool)
The UI is in an interact loop
$!lock-focus (Bool)
Lock the focus
$!screen (Terminal::UI::Screen)
The screen object, which tracks frames and panes.
Handles: pane, panes, frames, frame, find-frame
%!lock-interaction (Associative)
Lock interaction to only a set of actions
%!pane-bindings (Associative)
Key bindings for the focused pane
%!ui-actions (Associative)
Actions associated with bindings.
%!ui-bindings (Associative[Str])
UI bindings (not specific to a pane)
%!ui-sync-actions (Associative)
Synchronous actions associated with bindings.
METHODS
add-screen(Terminal::UI $:: |args --> Terminal::UI::Screen)
Add a screen to the ui. Arguments are sent to the Screen contructor
Show an alert box, and wait for a key press to dismiss it.
bind(Terminal::UI :: "pane", :name, *%kv)
Bind keys to events on the focused pane.
Bind keys to UI events, independent of the focused pane.
call(Terminal::UI :: Str action, :$arg, *%_)
Call the action with the given name.
Synonym for refresh
find-frame
Handled by $!screen
focus(Terminal::UI :: Str :frame!, Int :$pane!, *%_)
Set a pane and frame to be focused, using the name of the frame.
focus(Terminal::UI :: Str :pane where { ... }, *%_)
Set the next pane to be focused.
focus(Terminal::UI :: Int :pane, Int :$frame = 0, *%_)
Set a pane and frame to be focused, using the indexes (default 0,0).
focus(Terminal::UI :: Terminal::UI::Frame frame, Int :$pane = 0, *%_)
Set a pane and frame to be focused, using the frame.
focus(Terminal::UI :: Terminal::UI::Frame frame, Terminal::UI::Pane :$pane!, *%_)
Set a pane and frame to be focused, using the frame.
The currently focused pane within the currently focused frame.
frame
Handled by $!screen
frames
Handled by $!screen
get-key
Handled by $!input
help-text(Terminal::UI $:: *%_)
Auto generated help text, based on bindings
interact(Terminal::UI $:: *%_)
Respond to keyboard input, until we are done
keys(Terminal::UI :: Str :done, *%_ --> Supply)
a Supply of keyboard input; ends when $done is seen.
log(Terminal::UI :: Str file, *%_)
Starting logging to a file.
on(Terminal::UI $:: *%actions)
Associate names of actions with callables.
on-sync(Terminal::UI $:: *%actions)
Associate names of actions with synchronous callables.
pane
Handled by $!screen
panes
Handled by $!screen
pause-and-do(Terminal::UI $:: &code, *%_)
Pause the ui, run some code, and then restart
quietly(Terminal::UI $:: &code, *%_)
Suppress warnings and run code
refresh(Terminal::UI :: Bool :hard, *%_)
Refresh the screen, the frames, and their panes.
select-down(Terminal::UI $:: *%_)
Move down one line in the selected pane of the selected frame
select-up(Terminal::UI $:: *%_)
Move up one line in the selected pane of the selected frame
selected-meta(Terminal::UI $:: *%_)
The current metadata for the selected pane, within the selected frame
setup(Terminal::UI :: :pane!, *%_)
Set up with a single pane
setup(Terminal::UI $:: Callable :&heights!, *%_)
Set up with a callback with one frame that computes heights based on the total available height
setup(Terminal::UI :: Int :panes!, *%_)
Set up with a number of panes; evenly sized.
setup(Terminal::UI :: :ratios!, *%_)
Set up with panes that have the given ratios.
shutdown(Terminal::UI :: msg = Nil, *%_)
Shut down the UI, and optionally emit a message.
The global style object