| 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 | rw => [qw(buf pos cols prompt oldpos maxrows query)], | |
| 18 | 10 | ▶ | ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 19 | |||
| 20 | sub new { | ||
| 21 | 0 | ▶ | my $class = shift; |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 22 | 0 | bless { | |
| 23 | buf => '', | ||
| 24 | pos => 0, | ||
| 25 | oldpos => 0, | ||
| 26 | maxrows => 0, | ||
| 27 | }, $class; | ||
| 28 | } | ||
| 29 | 10 | ▶ | use Text::VisualWidth::PP 0.03 qw(vwidth); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | |||
| 31 | 0 | ▶ | sub len { length(shift->buf) } |
|
Subroutine
len: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 32 | 0 | ▶ | sub plen { length(shift->prompt) } |
|
Subroutine
plen: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 33 | |||
| 34 | sub vpos { | ||
| 35 | 0 | ▶ | my $self = shift; |
|
Subroutine
vpos: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 36 | 0 | vwidth(substr($self->buf, 0, $self->pos)); | |
| 37 | } | ||
| 38 | |||
| 39 | sub width { | ||
| 40 | 0 | ▶ | my $self = shift; |
|
Subroutine
width: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 41 | 0 | vwidth($self->prompt . $self->buf); | |
| 42 | } | ||
| 43 | |||
| 44 | 10 | 1; | |