line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Term::ReadLine::Perl5::OO::State; |
2
|
|
|
|
|
|
|
=pod |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Term::ReadLine::Perl5::OO:State |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 DESCRIPTION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Object to old the internal state of an editable line. Thas things like |
11
|
|
|
|
|
|
|
the text of the line and cursor position, |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use Class::Accessor::Lite 0.05 ( |
17
|
10
|
|
|
|
|
82
|
rw => [qw(buf pos cols prompt oldpos maxrows query)], |
18
|
10
|
|
|
10
|
|
2871
|
); |
|
10
|
|
|
|
|
11114
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
22
|
0
|
|
|
|
|
|
bless { |
23
|
|
|
|
|
|
|
buf => '', |
24
|
|
|
|
|
|
|
pos => 0, |
25
|
|
|
|
|
|
|
oldpos => 0, |
26
|
|
|
|
|
|
|
maxrows => 0, |
27
|
|
|
|
|
|
|
}, $class; |
28
|
|
|
|
|
|
|
} |
29
|
10
|
|
|
10
|
|
1919
|
use Text::VisualWidth::PP 0.03 qw(vwidth); |
|
10
|
|
|
|
|
220
|
|
|
10
|
|
|
|
|
1456
|
|
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
0
|
|
sub len { length(shift->buf) } |
32
|
0
|
|
|
0
|
0
|
|
sub plen { length(shift->prompt) } |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub vpos { |
35
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
36
|
0
|
|
|
|
|
|
vwidth(substr($self->buf, 0, $self->pos)); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub width { |
40
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
41
|
0
|
|
|
|
|
|
vwidth($self->prompt . $self->buf); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |