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 |
|
|
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 |
|
|
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; |
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. |
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. |
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 |
|
|
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 |
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 |
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 |
|
|
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 |
|
|
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. |
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 |
|
|