/[Term-Shelly]/trunk/lib/Term/Shelly.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Term/Shelly.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 9 by dpavlin, Mon Jun 25 10:04:07 2007 UTC revision 10 by dpavlin, Mon Jun 25 12:31:11 2007 UTC
# Line 14  I needed a shell kit for an aim client I Line 14  I needed a shell kit for an aim client I
14    
15  =head1 NEEDS  =head1 NEEDS
16    
17   - Settable key bindings    - Settable key bindings
18   - history    - history
19   - vi mode (Yeah, I lub vi)    - vi mode (Yeah, I lub vi)
20    
21  =head1 DONE  =head1 DONE
22    
23   - Callback for 'anykey'    - Callback for 'anykey'
24   - Tab completion    - Tab completion
25   - Support for window size changes (sigwinch)    - Support for window size changes (sigwinch)
26   - movement/in-line editing.    - movement/in-line editing.
27   - Completion function calls    - Completion function calls
28   - Settable callbacks for when we have an end-of-line (EOL binding?)    - Settable callbacks for when we have an end-of-line (EOL binding?)
29    
30  =cut  =cut
31    
# Line 76  my %KEY_CONSTANTS = ( Line 76  my %KEY_CONSTANTS = (
76    
77  =head1 DESCRIPTION  =head1 DESCRIPTION
78    
79  =over 4  =head1 METHODS
80    
81    =head2 new
82    
83      my $sh = Term::Shelly->new();
84    
85  =cut  =cut
86    
# Line 91  sub new ($) { Line 95  sub new ($) {
95                  "echo" => 1,                  "echo" => 1,
96                  "vi_mode" => 0,                  "vi_mode" => 0,
97                  "mode" => "insert",                  "mode" => "insert",
98                  "debug" => 1,                  "debug" => 0,
99          };          };
100    
101          bless $self, $class;          bless $self, $class;
# Line 246  sub DESTROY { Line 250  sub DESTROY {
250    
251  =pod  =pod
252    
253  =item $sh->do_one_loop()  =head2 $sh->do_one_loop()
254    
255  Does... one... loop. Makes a pass at grabbing input and processing it. For  Does... one... loop. Makes a pass at grabbing input and processing it. For
256  speedy pasts, this loops until there are no characters left to read.  speedy pasts, this loops until there are no characters left to read.
# Line 274  sub do_one_loop ($) { Line 278  sub do_one_loop ($) {
278    
279  =pod  =pod
280    
281  =item handle_key($key)  =head2 handle_key($key)
282    
283  Handle a single character input. This is not a "key press" so much as doing all  Handle a single character input. This is not a "key press" so much as doing all
284  the necessary things to handle key presses.  the necessary things to handle key presses.
# Line 285  sub handle_key($$) { Line 289  sub handle_key($$) {
289          my $self = shift;          my $self = shift;
290          my $char = shift;          my $char = shift;
291    
292            $self->debug("handle_key( '$char' == ", ord($char), " )");
293    
294          my $line = $self->{"input_line"} || "";          my $line = $self->{"input_line"} || "";
295          my $pos = $self->{"input_position"} || 0;          my $pos = $self->{"input_position"} || 0;
296    
# Line 367  sub handle_key($$) { Line 373  sub handle_key($$) {
373    
374  =pod  =pod
375    
376  =item execute_binding(raw_key)  =head2 execute_binding(raw_key)
377    
378  Guess what this does? Ok I'll explain anyway... It takes a key and prettifies  Guess what this does? Ok I'll explain anyway... It takes a key and prettifies
379  it, then checks the known key bindings for a mapping and checks if that mapping  it, then checks the known key bindings for a mapping and checks if that mapping
# Line 415  sub execute_binding ($$) { Line 421  sub execute_binding ($$) {
421    
422  =pod  =pod
423    
424  =item prettify_key(raw_key)  =head2 prettify_key(raw_key)
425    
426  This happy function lets me turn raw input into something less ugly. It turns  This happy function lets me turn raw input into something less ugly. It turns
427  control keys into their equivalent ^X form. It does some other things to turn  control keys into their equivalent ^X form. It does some other things to turn
# Line 454  sub prettify_key ($$) { Line 460  sub prettify_key ($$) {
460    
461  =pod  =pod
462    
463  =item real_out($string)  =head2 real_out($string)
464    
465  This function allows you to bypass any sort of evil shenanigans regarding output fudging. All this does is 'print @_;'  This function allows you to bypass any sort of evil shenanigans regarding output fudging. All this does is 'print @_;'
466    
# Line 488  sub debug ($;$) { Line 494  sub debug ($;$) {
494    
495  =pod  =pod
496    
497  =item fix_inputline  =head2 fix_inputline
498    
499  This super-happy function redraws the input line. If input_position is beyond the bounds of the terminal, it'll shuffle around so that it can display it. This function is called just about any time any key is hit.  This super-happy function redraws the input line. If input_position is beyond the bounds of the terminal, it'll shuffle around so that it can display it. This function is called just about any time any key is hit.
500    
# Line 869  sub vi_delete { Line 875  sub vi_delete {
875    
876  =pod  =pod
877    
878  =item $sh->complete_word  =head2 $sh->complete_word
879    
880  This is called whenever the complete-word binding is triggered. See the  This is called whenever the complete-word binding is triggered. See the
881  COMPLETION section below for how to write your own completion function.  COMPLETION section below for how to write your own completion function.
# Line 960  sub anykey { Line 966  sub anykey {
966    
967  =pod  =pod
968    
969  =item $sh->prompt([$prompt])  =head2 $sh->prompt([$prompt])
970    
971  Get or set the prompt  Get or set the prompt
972    

Legend:
Removed from v.9  
changed lines
  Added in v.10

  ViewVC Help
Powered by ViewVC 1.1.26