NAME
Term::Visual - split-terminal user interface
SYNOPSIS
#!/usr/bin/perl -w
use strict;
use Term::Visual;
my $vt = Term::Visual->new( Alias => "interface",
Errlevel => 0 );
$vt->set_palette( mycolor => "magenta on black",
thiscolor => "green on black" );
my $window_id = $vt->create_window(
Window_Name => "foo",
Status => { 0 =>
{ format => "template for status line 1",
fields => [qw( foo bar )] },
1 =>
{ format => "template for status line 2",
fields => [ qw( biz baz ) ] },
},
Buffer_Size => 1000,
History_Size => 50,
Use_Title => 0, # Don't use a titlebar
Use_Status => 0, # Don't use a statusbar
Title => "Title of foo" );
$vt->set_status_field( $window_id, bar => $value );
$vt->print( $window_id, "my Window ID is $window_id" );
$vt->shutdown; # not implemented yet.
for now use delete_window
$vt->delete_window( $window_id );
PUBLIC METHODS
Term::Visual->method();
- new
-
Create and initialize a new instance of Term::Visual.
my $vt = Term::Visual->new( Alias => "interface", Errlevel => 0 );
Alias is a session alias for POE.
Errlevel not implemented yet.
Errlevel sets Term::Visual's error level.
- create_window
-
my $window_id = $vt->create_window( ... );
Set the window's name
Window_Name => "foo"
Set the Statusbar's format
Status => { 0 => # first statusline { format => "\0(st_frames)" . " [" . "\0(st_values)" . "%8.8s" . "\0(st_frames)" . "] " . "\0(st_values)" . "%s", fields => [qw( time name )] }, 1 => # second statusline { format => "foo %s bar %s", fields => [qw( foo bar )] }, }
Set the size of the scrollback buffer
Buffer_Size => 1000
Set the command history size
History_Size => 50
Set the title of the window
Title => "This is the Titlebar"
Don't use Term::Visual's Titlebar.
Use_Title => 0
Don't use Term::Visual's StatusBar.
Use_Status => 0
No need to declare Use_Status or Use_Title if you want to use the Statusbar or Titlebar.
-
Prints lines of text to the main screen of a window
$vt->print( $window_id, "this is a string" ); my @array = qw(foo bar biz baz); $vt->print( $window_id, @array );
- current_window
-
my $current_window = $vt->current_window; $vt->print( $current_window, "current window is $current_window" );
- get_window_name
-
my $window_name = $vt->get_window_name( $window_id );
- get_window_id
-
my $window_id = $vt->get_window_id( $window_name );
- delete_window
-
$vt->delete_window($window_id);
or
$vt->delete_window(@window_ids);
- validate_window
-
my $validity = $vt->validate_window( $window_id );
or
my $validity = $vt->validate_window( $window_name ); if ($validity) { do stuff };
- get_palette
-
Return color palette or a specific colorname's description.
my %palette = $vt->get_palette(); my $color_desc = $vt->get_palette($colorname); my ($foo, $bar) = $vt->get_palette($biz, $baz);
- set_palette
-
Set the color palette or specific colorname's value.
$vt->set_palette( color_name => "color on color" ); $vt->set_palette( color_name => "color on color", another => "color on color" ); NOTE: (ncolor, st_values, st_frames, stderr_text, stderr_bullet, statcolor) are set and used by Term::Visual internally. It is safe to redifine there values.
- set_title
-
$vt->set_title( $window_id, "This is the new Title" );
- get_title
-
my $title = $vt->get_title( $window_id );
- change_window
-
Switch between windows
$vt->change_window( $window_id ); $vt->change_window( 0 ); ... $vt->change_window( 1 );
- set_status_format
-
$vt->set_status_format( $window_id, 0 => { format => "template for status line 1", field => [ qw( foo bar ) ] }, 1 => { format => "template for status line 2", field => [ qw( biz baz ) ] }, );
- set_status_field
-
$vt->set_status_field( $window_id, field => "value" ); $vt->set_status_field( $window_id, foo => "bar", biz => "baz" );
Internal Keystrokes
- Ctrl A or KEY_HOME
-
Move to BOL.
- KEY_LEFT
-
Back one character.
- Alt P or Esc KEY_LEFT
-
Switch Windows decrementaly.
- Alt N or Esc KEY_RIGHT
-
Switch Windows incrementaly.
- Alt K or KEY_END
-
Not implemented yet.
Kill a Window.
- Ctrl \
-
Kill Term::Visual.
- Ctrl D or KEY_DC
-
Delete a character.
- Ctrl E or KEY_LL
-
Move to EOL.
- Ctrl F or KEY_RIGHT
-
Forward a character.
- Ctrl H or KEY_BACKSPACE
-
Backward delete character.
- Ctrl J or Ctrl M 'Return'
-
Accept a line.
- Ctrl K
-
Kill to EOL.
- Ctrl L or KEY_RESIZE
-
Refresh screen.
- Ctrl N
-
Next in history.
- Ctrl P
-
Previous in history.
- Ctrl Q
-
Display input status.
- Ctrl T
-
Transpose characters.
- Ctrl U
-
Discard line.
- Ctrl W
-
Word rubout.
- Esc C
-
Capitalize word to right of cursor.
- Esc U
-
Uppercase WORD.
- Esc L
-
Lowercase word.
- Esc F
-
Forward one word.
- Esc B
-
Backward one word.
- Esc D
-
Delete a word forward.
- Esc T
-
Transpose words.
- KEY_IC 'Insert'
-
Toggle Insert mode.
- KEY_PPAGE 'Page Down'
-
Scroll down a page.
- KEY_NPAGE 'Page Up'
-
Scroll up a page.
- KEY_UP
-
Scroll up a line.
- KEY_DOWN
-
Scroll down a line.
Author
- Charles Ayres
-
Except where otherwise noted, Term::Visual is Copyright 2002, 2003 Charles Ayres. All rights reserved. Term::Visual is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
Questions and Comments can be sent to lunartear+visterm@ambientheory.com
Acknowledgments
- Rocco Caputo
-
A Big thanks to Rocco Caputo.
Rocco has contributed to the development of Term::Visual In many ways.
Rocco Caputo <troc+visterm@pobox.com>
Thank you!