| 1 | package Term::ReadLine::Perl5::OO; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 10 | ▶ | use 5.008005; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 10 | ▶ | use strict; use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 10 | ▶ | use POSIX qw(termios_h); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 10 | ▶ | use Storable; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 10 | ▶ | use Text::VisualWidth::PP 0.03 qw(vwidth); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 10 | ▶ | use Unicode::EastAsianWidth::Detect qw(is_cjk_lang); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 10 | ▶ | use Term::ReadKey qw(GetTerminalSize ReadLine ReadKey ReadMode); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 10 | ▶ | use IO::Handle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 10 | ▶ | use English; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 10 | ▶ | eval "use rlib '.' "; # rlib is now optional | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 10 | ▶ | use Term::ReadLine::Perl5::OO::History; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 10 | ▶ | use Term::ReadLine::Perl5::OO::Keymap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 10 | ▶ | use Term::ReadLine::Perl5::OO::State; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 10 | ▶ | use Term::ReadLine::Perl5::Common; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 10 | ▶ | use Term::ReadLine::Perl5::readline; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 10 | ▶ | use Term::ReadLine::Perl5::TermCap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 10 | our $VERSION = "0.40"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 10 | ▶ | use constant HISTORY_NEXT => +1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 10 | ▶ | use constant HISTORY_PREV => -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 10 | my $IS_WIN32 = $^O eq 'MSWin32'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 10 | ▶ | require Win32::Console::ANSI if $IS_WIN32; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | use Class::Accessor::Lite 0.05 ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 10 | rw => [qw(completion_callback rl_MaxHistorySize)], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 10 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | use constant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 10 | CTRL_B => 2, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | CTRL_C => 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | CTRL_F => 6, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | CTRL_H => 8, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | CTRL_Z => 26, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | BACKSPACE => 127, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | ENTER => 13, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | TAB => 9, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | ESC => 27, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 10 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 10 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 10 | *add_history = \&Term::ReadLine::Perl5::OO::History::add_history; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 10 | *read_history = \&Term::ReadLine::Perl5::OO::History::read_history; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 10 | *write_history = \&Term::ReadLine::Perl5::OO::History::write_history; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 10 | ▶ | use warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 10 | my %attribs = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | stiflehistory => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | getHistory => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | addHistory => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | attribs => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | appname => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | autohistory => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | readHistory => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | setHistory => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 10 | my %features = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | appname => 1, # "new" is recognized | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | minline => 1, # we have a working MinLine() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | autohistory => 1, # lines are put into history automatically, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # subject to MinLine() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | getHistory => 1, # we have a working getHistory() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | setHistory => 1, # we have a working setHistory() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | addHistory => 1, # we have a working add_history(), addhistory(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # or addHistory() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | attribs => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | stiflehistory => 1, # we have stifle_history() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | sub Attribs { \%attribs; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Attribs: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub Features { \%features; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Features: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 10 | our @EmacsKeymap = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | =head3 new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | B<new>([I<%options>]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | returns the handle for subsequent calls to following functions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | Argument is the name of the application. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 1 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 1 | ▶ | my %args = @_==1? %{$_[0]} : @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | my $self = bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | char => undef, # last character | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | current_keymap => Term::ReadLine::Perl5::OO::Keymap::EmacsKeymap(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | toplevel_keymap => Term::ReadLine::Perl5::OO::Keymap::EmacsKeymap(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | debug => !!$ENV{CAROLINE_DEBUG}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | history_base => 0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | history_stifled => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | minlength => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | multi_line => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | rl_HistoryIndex => 0, # Is set on use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | rl_MaxHistorySize => 100, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | rl_history_length => 0, # is set on use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | rl_max_input_history => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | state => undef, # line buffer and its state | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | rl_History => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | rl_term_set => \@Term::ReadLine::TermCap::rl_term_set, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | %args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | sub debug { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | my ($self, $stuff) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | return unless $self->{debug}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | # require JSON::PP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | open my $fh, '>>:utf8', 'readline-oo.debug.log'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | print $fh $stuff; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | # print $fh JSON::PP->new->allow_nonref(1)->encode($stuff) . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | sub is_supported($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_supported: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | return 1 if $IS_WIN32; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | my $term = $ENV{'TERM'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | return 0 unless defined $term; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | return 0 if $term eq 'dumb'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | return 0 if $term eq 'cons25'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | #### FIXME redo this history stuff: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 1 | ▶ | sub history($) { shift->{rl_History} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
history: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | sub history_len($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | shift->{rl_history_length}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
history_len: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | sub refresh_line { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | my ($self, $state) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refresh_line: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if ($self->{multi_line}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $self->refresh_multi_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $self->refresh_single_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | sub refresh_multi_line { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | my ($self, $state) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refresh_multi_line: not called CC=13 SCAR=52.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | my $plen = vwidth($state->prompt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | $self->debug($state->buf . "\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # rows used by current buf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | my $rows = int(($plen + vwidth($state->buf) + $state->cols -1) / $state->cols); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | if (defined $state->query) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | $rows++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | # cursor relative row | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | my $rpos = int(($plen + $state->oldpos + $state->cols) / $state->cols); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | my $old_rows = $state->maxrows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # update maxrows if needed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if ($rows > $state->maxrows) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | $state->maxrows($rows); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $self->debug(sprintf "[%d %d %d] p: %d, rows: %d, rpos: %d, max: %d, oldmax: %d", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | $state->len, $state->pos, $state->oldpos, $plen, $rows, $rpos, $state->maxrows, $old_rows); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | # First step: clear all the lines used before. To do start by going to the last row. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | if ($old_rows - $rpos > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $self->debug(sprintf ", go down %d", $old_rows-$rpos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | printf STDOUT "\x1b[%dB", $old_rows-$rpos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | # Now for every row clear it, go up. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my $j; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | for ($j=0; $j < ($old_rows-1); ++$j) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $self->debug(sprintf ", clear+up %d %d", $old_rows-1, $j); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | print("\x1b[0G\x1b[0K\x1b[1A"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # Clean the top line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $self->debug(", clear"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | print("\x1b[0G\x1b[0K"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | # Write the prompt and the current buffer content | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | print $state->prompt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | print $state->buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | if (defined $state->query) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | print "\015\nSearch: " . $state->query; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | # If we are at the very end of the screen with our prompt, we need to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | # emit a newline and move the prompt to the first column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | if ($state->pos && $state->pos == $state->len && ($state->pos + $plen) % $state->cols == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$state->pos and $state->pos == $state->len and ($state->pos + $plen) % $state->cols == 0
$state->pos and $state->pos == $state->len
MC/DC0%0/3
$state->pos and $state->pos == $state->len and ($state->pos + $plen) % $state->cols == 0
$state->pos
$state->pos == $state->len
($state->pos + $plen) % $state->cols == 0
Truth table0%0/4
A and B and C
A= $state->posB= $state->pos == $state->lenC= ($state->pos + $plen) % $state->cols == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | $self->debug("<newline>"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | print "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | print "\x1b[0G"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $rows++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | if ($rows > $state->maxrows) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | $state->maxrows(int $rows); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # Move cursor to right position | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | my $rpos2 = int(($plen + $state->vpos + $state->cols) / $state->cols); # current cursor relative row | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | $self->debug(sprintf ", rpos2 %d", $rpos2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # Go up till we reach the expected position | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | if ($rows - $rpos2 > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | # cursor up | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | printf "\x1b[%dA", $rows-$rpos2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | # Set column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | my $col; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $col = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my $buf = $state->prompt . substr($state->buf, 0, $state->pos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | for (split //, $buf) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $col += vwidth($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | if ($col > $state->cols) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | $col -= $state->cols; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | $self->debug(sprintf ", set col %d", $col); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | printf "\x1b[%dG", $col; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $state->oldpos($state->pos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $self->debug("\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # Show the line, default inverted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | sub redisplay_inverted($$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | my ($self, $line) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
redisplay_inverted: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | # FIXME: fixup from readline::redisplay_high | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | # get_ornaments_selected(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | # @$rl_term_set[2,3,4,5] = @$rl_term_set[4,5,2,3]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | # Show the line, default inverted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | print STDOUT $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | # FIXME: fixup from readline::redisplay_high | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | # @$rl_term_set[2,3,4,5] = @$rl_term_set[4,5,2,3]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | sub refresh_single_line($$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | my ($self, $state) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refresh_single_line: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my $buf = $state->buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my $len = $state->len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | my $pos = $state->pos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | while ((vwidth($state->prompt)+$pos) >= $state->cols) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | substr($buf, 0, 1) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | $len--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | $pos--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | while (vwidth($state->prompt) + vwidth($buf) > $state->cols) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $len--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | print STDOUT "\x1b[0G"; # cursor to left edge | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | $self->redisplay_high($self->{prompt}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | print STDOUT $buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | print STDOUT "\x1b[0K"; # erase to right | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | # Move cursor to original position | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | printf "\x1b[0G\x1b[%dC", ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | length($state->{prompt}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | + vwidth(substr($buf, 0, $pos)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | sub edit_insert { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | my ($self, $state, $c) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
edit_insert: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | if (length($state->buf) == $state->pos) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | $state->{buf} .= $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | substr($state->{buf}, $state->{pos}, 0) = $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | $state->{pos}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | sub edit_delete_prev_word { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | my ($self, $state) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
edit_delete_prev_word: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | my $old_pos = $state->pos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | while ($state->pos > 0 && substr($state->buf, $state->pos-1, 1) eq ' ') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$state->pos > 0 and substr($state->buf, $state->pos - 1, 1) eq " "
MC/DC0%0/2
$state->pos > 0 and substr($state->buf, $state->pos - 1, 1) eq " "
$state->pos > 0
substr($state->buf, $state->pos - 1, 1) eq " "
Truth table0%0/3
A and B
A= $state->pos > 0B= substr($state->buf, $state->pos - 1, 1) eq " "
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | $state->{pos}--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | while ($state->pos > 0 && substr($state->buf, $state->pos-1, 1) ne ' ') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$state->pos > 0 and substr($state->buf, $state->pos - 1, 1) ne " "
MC/DC0%0/2
$state->pos > 0 and substr($state->buf, $state->pos - 1, 1) ne " "
$state->pos > 0
substr($state->buf, $state->pos - 1, 1) ne " "
Truth table0%0/3
A and B
A= $state->pos > 0B= substr($state->buf, $state->pos - 1, 1) ne " "
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | $state->{pos}--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | my $diff = $old_pos - $state->pos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | substr($state->{buf}, $state->pos, $diff) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | sub edit_history($$$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | my ($self, $state, $dir) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
edit_history: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my $hist_len = $self->{rl_history_length}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | if ($hist_len > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $self->{rl_HistoryIndex} += $dir ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | if ($self->{rl_HistoryIndex} <= 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | $self->F_Ding(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | $self->{rl_HistoryIndex} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | } elsif ($self->{rl_HistoryIndex} > $hist_len) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | $self->F_Ding(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | $self->{rl_HistoryIndex} = $hist_len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | $state->{buf} = $self->{rl_History}->[$self->{rl_HistoryIndex}-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $state->{pos} = $state->len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | ######################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | sub F_AcceptLine($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_AcceptLine: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | my $buf = $self->{state}->buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | Term::ReadLine::Perl5::OO::History::add_history($self, $buf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | return (1, $buf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | sub F_BackwardChar($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_BackwardChar: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | if ($state->pos > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | $state->{pos}--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | sub F_BackwardDeleteChar($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_BackwardDeleteChar: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | if ($state->pos > 0 && length($state->buf) > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$state->pos > 0 and length $state->buf > 0
MC/DC0%0/2
$state->pos > 0 and length $state->buf > 0
$state->pos > 0
length $state->buf > 0
Truth table0%0/3
A and B
A= $state->pos > 0B= length $state->buf > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | substr($state->{buf}, $state->pos-1, 1) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | $state->{pos}--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | sub F_BeginningOfLine($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_BeginningOfLine: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | $state->{pos} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | sub F_ClearScreen($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_ClearScreen: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | print STDOUT "\x1b[H\x1b[2J"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | sub F_DeleteChar($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_DeleteChar: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | if (length($state->buf) > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $self->edit_delete($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | sub F_EndOfLine($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_EndOfLine: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | $state->{pos} = length($state->buf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | sub F_Ding($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_Ding: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | Term::ReadLine::Perl5::Common::F_Ding(*STDERR); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | sub F_ForwardChar($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_ForwardChar: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | if ($state->pos != length($state->buf)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | $state->{pos}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | sub F_Interrupt() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_Interrupt: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $self->{sigint}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | sub F_KillLine($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_KillLine: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | substr($state->{buf}, $state->{pos}) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | sub F_NextHistory($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_NextHistory: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | $self->edit_history($state, HISTORY_NEXT); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | ## Execute the next character input as a command in a meta keymap. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | sub F_PrefixMeta | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_PrefixMeta: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | my $cc = ord($self->{char}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | $self->{current_keymap} = $self->{function}[$cc]->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | sub F_PreviousHistory($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_PreviousHistory: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | $self->edit_history($state, HISTORY_PREV); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | sub F_ReverseSearchHistory($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_ReverseSearchHistory: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | $self->search($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | sub F_SelfInsert($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_SelfInsert: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | my $c = $self->{char}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | $self->debug("inserting ord($c)\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | $self->edit_insert($state, $c); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # tuple[0] == '' signals not to eval function again | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | return '', undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | sub F_Suspend($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_Suspend: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | $self->{sigtstp}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | return 1, $state->buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | # swaps current character with previous | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | sub F_TransposeChars($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_TransposeChars: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | ▶ | if ($state->pos > 0 && $state->pos < $state->len) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$state->pos > 0 and $state->pos < $state->len
MC/DC0%0/2
$state->pos > 0 and $state->pos < $state->len
$state->pos > 0
$state->pos < $state->len
Truth table0%0/3
A and B
A= $state->pos > 0B= $state->pos < $state->len
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | my $aux = substr($state->buf, $state->pos-1, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | substr($state->{buf}, $state->pos-1, 1) = substr($state->{buf}, $state->pos, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | substr($state->{buf}, $state->pos, 1) = $aux; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | if ($state->pos != $state->len -1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $state->{pos}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | sub F_UnixLineDiscard($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_UnixLineDiscard: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | $state->{buf} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | $state->{pos} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | sub F_UnixRubout($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
F_UnixRubout: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | $self->edit_delete_prev_word($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | return undef, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | ######################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 1 | ▶ | shift->disable_raw_mode(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 1 | Term::ReadLine::Perl5::readline::ResetTTY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | sub readline { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | my ($self, $prompt) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readline: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | ▶ | $prompt = '> ' unless defined $prompt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | STDOUT->autoflush(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | local $Text::VisualWidth::PP::EastAsian = is_cjk_lang; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | if ($self->is_supported && -t STDIN) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->is_supported and -t STDIN
MC/DC0%0/2
$self->is_supported and -t STDIN
$self->is_supported
-t STDIN
Truth table0%0/3
A and B
A= $self->is_supportedB= -t STDIN
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | return $self->read_raw($prompt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | print STDOUT $prompt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | STDOUT->flush; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | # I need to use ReadLine() to support Win32. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | my $line = ReadLine(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | ▶ | $line =~ s/\n$// if defined $line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | return $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | sub get_columns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_columns: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | my ($wchar, $hchar, $wpixels, $hpixels) = GetTerminalSize(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | return $wchar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | sub readkey { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readkey: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | my $c = ReadKey(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | ▶ | return undef unless defined $c; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | ▶ | return $c unless $IS_WIN32; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | # Win32 API always return the bytes encoded with ACP. So it must be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | # decoded from double byte sequence. To detect double byte sequence, it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | # use Win32 API IsDBCSLeadByte. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | require Win32::API; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | require Encode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | require Term::Encoding; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | ▶ | $self->{isleadbyte} ||= Win32::API->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"isleadbyte"} ||= "Win32::API"->new("kernel32", "int IsDBCSLeadByte(char a)")
MC/DC0%0/2
$self->{"isleadbyte"} ||= "Win32::API"->new("kernel32", "int IsDBCSLeadByte(char a)")
$self->{"isleadbyte"}
"Win32::API"->new("kernel32", "int IsDBCSLeadByte(char a)")
Truth table0%0/3
A ||= B
A= $self->{"isleadbyte"}B= "Win32::API"->new("kernel32", "int IsDBCSLeadByte(char a)")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 'kernel32', 'int IsDBCSLeadByte(char a)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | $self->{encoding} ||= Term::Encoding::get_encoding(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"encoding"} ||= Term::Encoding::get_encoding()
MC/DC0%0/2
$self->{"encoding"} ||= Term::Encoding::get_encoding()
$self->{"encoding"}
Term::Encoding::get_encoding()
Truth table0%0/3
A ||= B
A= $self->{"encoding"}B= Term::Encoding::get_encoding()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | if ($self->{isleadbyte}->Call($c)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | $c .= ReadKey(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | $c = Encode::decode($self->{encoding}, $c); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | # linenoiseRaw | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | sub read_raw { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | ▶ | my ($self, $prompt) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_raw: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | local $self->{sigint}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | local $self->{sigtstp}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | my $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | $self->enable_raw_mode(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | $ret = $self->edit($prompt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | $self->disable_raw_mode(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | print STDOUT "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | STDOUT->flush; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | ▶ | if ($self->{sigint}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | kill 'INT', $$; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | } elsif ($self->{sigtstp}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | ▶ | kill $IS_WIN32 ? 'INT' : 'TSTP', $$; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | sub enable_raw_mode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enable_raw_mode: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | ▶ | if ($IS_WIN32) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | ReadMode(5); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | my $termios = POSIX::Termios->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | $termios->getattr(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | $self->{rawmode} = [$termios->getiflag, $termios->getoflag, $termios->getcflag, $termios->getlflag, $termios->getcc(VMIN), $termios->getcc(VTIME)]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | $termios->setiflag($termios->getiflag & ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | $termios->setoflag($termios->getoflag & ~(OPOST)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | $termios->setcflag($termios->getcflag | ~(CS8)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | $termios->setlflag($termios->getlflag & ~(ECHO|ICANON|IEXTEN | ISIG)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | $termios->setcc(VMIN, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | $termios->setcc(VTIME, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | $termios->setattr(0, TCSAFLUSH); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | sub disable_raw_mode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disable_raw_mode: called CC=3 SCAR=17.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 1 | ▶ | if ($IS_WIN32) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | ReadMode(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 1 | ▶ | if (my $r = delete $self->{rawmode}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | my $termios = POSIX::Termios->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | $termios->getattr(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | $termios->setiflag($r->[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | $termios->setoflag($r->[1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | $termios->setcflag($r->[2]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | $termios->setlflag($r->[3]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | $termios->setcc(VMIN, $r->[4]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | $termios->setcc(VTIME, $r->[5]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | $termios->setattr(0, TCSAFLUSH); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 1 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | sub lookup_key($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | ▶ | my ($self, $cc) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lookup_key: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | my $tuple = $self->{current_keymap}{function}->[$cc]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | ▶ | return $tuple if $tuple && defined($tuple->[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tuple and defined $tuple->[0]
MC/DC0%0/2
$tuple and defined $tuple->[0]
$tuple
defined $tuple->[0]
Truth table0%0/3
A and B
A= $tupleB= defined $tuple->[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | my $fn_raw = $self->{current_keymap}{default}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | my $fn = "F_${fn_raw}()"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | print "+++", $fn, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | my($done, $retval); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | my $cmd = "(\$done, \$retval) = \$self->$fn"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | # print $cmd, "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | eval($cmd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | return [$done, $retval]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | sub edit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | ▶ | my ($self, $prompt) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
edit: not called CC=23 SCAR=63.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | print STDOUT $prompt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | STDOUT->flush; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | my $state = Term::ReadLine::Perl5::OO::State->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | $state->{prompt} = $prompt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 0 | $state->cols($self->get_columns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | $self->debug("Columns: $state->{cols}\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | $self->{state} = $state; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | my $c = $self->readkey; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | ▶ | unless (defined $c) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | return $state->buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | ▶ | my $cc = ord($c) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | ▶ | if ($cc == TAB && defined $self->{completion_callback}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cc == 9 and defined $self->{"completion_callback"}
MC/DC0%0/2
$cc == 9 and defined $self->{"completion_callback"}
$cc == 9
defined $self->{"completion_callback"}
Truth table0%0/3
A and B
A= $cc == 9B= defined $self->{"completion_callback"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | $c = $self->complete_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | ▶ | return undef unless defined $c; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | $cc = ord($c); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | ▶ | next if $cc == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | $self->{char} = $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | my $tuple = $self->lookup_key($cc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | ▶ | if ($tuple && $tuple->[0] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tuple and $tuple->[0]
MC/DC0%0/2
$tuple and $tuple->[0]
$tuple
$tuple->[0]
Truth table0%0/3
A and B
A= $tupleB= $tuple->[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | my $fn = sprintf "F_%s()", $tuple->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | my($done, $retval); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | ###### DEBUG ###### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | # if ($fn eq 'F_PrefixMeta()') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | # print "+++ Switching keymap\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | # $self->{current_keymap} = $tuple->[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | # next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | my $cmd = "(\$done, \$retval) = \$self->$fn"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | # use Data::Printer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | # print "+++ cmd:\n$cmd\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | # p $tuple; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | eval($cmd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | ▶ | return $retval if $done; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | # print "+++ Back to top\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | $self->{current_keymap} = $self->{toplevel_keymap} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | # FIXME: When doing keymap lookup, I need a way to note that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | # we want a return rather than to continue editing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | ▶ | if ($cc == ESC) { # escape sequence | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | # Read the next two bytes representing the escape sequence | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | ▶ | my $buf = $self->readkey or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | ▶ | $buf .= $self->readkey or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | ▶ | if ($buf eq "[D") { # left arrow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | $self->F_BackwardChar($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | } elsif ($buf eq "[C") { # right arrow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | $self->F_ForwardChar($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | } elsif ($buf eq "[A") { # up arrow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | $self->F_PreviousHistory($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | } elsif ($buf eq "[B") { # down arrow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | $self->F_NextHistory($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | } elsif ($buf eq "[1") { # home | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | ▶ | $buf = $self->readkey or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | ▶ | if ($buf eq '~') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | $state->{pos} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | } elsif ($buf eq "[4") { # end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | ▶ | $buf = $self->readkey or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | ▶ | if ($buf eq '~') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | $state->{pos} = length($state->buf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | # TODO: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | # else if (seq[0] == 91 && seq[1] > 48 && seq[1] < 55) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | # /* extended escape, read additional two bytes. */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | # if (read(fd,seq2,2) == -1) break; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | # if (seq[1] == 51 && seq2[0] == 126) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | # /* Delete key. */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | # linenoiseEditDelete(&l); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | return $state->buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | sub edit_delete { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | ▶ | my ($self, $status) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
edit_delete: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | ▶ | if ($status->len > 0 && $status->pos < $status->len) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$status->len > 0 and $status->pos < $status->len
MC/DC0%0/2
$status->len > 0 and $status->pos < $status->len
$status->len > 0
$status->pos < $status->len
Truth table0%0/3
A and B
A= $status->len > 0B= $status->pos < $status->len
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | substr($status->{buf}, $status->pos, 1) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | $self->refresh_line($status); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | sub search { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | ▶ | my ($self, $state) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
search: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | my $query = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | local $state->{query} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | LOOP: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | my $c = $self->readkey; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | ▶ | unless (defined $c) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | return $state->buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | ▶ | my $cc = ord($c) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$cc == 2 or $cc == 3 or $cc == 6 or $cc == 13
$cc == 2 or $cc == 3 or $cc == 6
$cc == 2 or $cc == 3
MC/DC0%0/4
$cc == 2 or $cc == 3 or $cc == 6 or $cc == 13
$cc == 2
$cc == 3
$cc == 6
$cc == 13
Truth table0%0/5
A or B or C or D
A= $cc == 2B= $cc == 3C= $cc == 6D= $cc == 13
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | $cc == CTRL_B | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | || $cc == CTRL_C | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | || $cc == CTRL_F | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | || $cc == ENTER | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | ▶ | if ($cc == BACKSPACE || $cc == CTRL_H) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cc == 127 or $cc == 8
MC/DC0%0/2
$cc == 127 or $cc == 8
$cc == 127
$cc == 8
Truth table0%0/3
A or B
A= $cc == 127B= $cc == 8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | $self->debug("ctrl-h in searching\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | $query =~ s/.\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | $query .= $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | $self->debug("C: $cc\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | $state->query($query); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 0 | $self->debug("Searching '$query'\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | SEARCH: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | for my $hist (@{$self->history}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | ▶ | if ((my $idx = index($hist, $query)) >= 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | $state->buf($hist); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | $state->pos($idx); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | next LOOP; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | $self->F_Ding(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | sub complete_line { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | ▶ | my ($self, $state) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
complete_line: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 0 | my @ret = grep { defined $_ } $self->{completion_callback}->($state->buf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | ▶ | unless (@ret) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | $self->F_Ding(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | return "\0"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | # Show completion or original buffer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | ▶ | if ($i < @ret) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 0 | my $cloned = Storable::dclone($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | $cloned->{buf} = $ret[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | $cloned->{pos} = length($cloned->{buf}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | $self->refresh_line($cloned); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | my $c = $self->readkey; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | ▶ | unless (defined $c) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | ▶ | my $cc = ord($c) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | ▶ | if ($cc == TAB) { # tab | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | $i = ($i+1) % (1+@ret); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | ▶ | if ($i==@ret) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | $self->F_Ding(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | } elsif ($cc == ESC) { # escape | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | # Re-show original buffer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | ▶ | if ($i<@ret) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | $self->refresh_line($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | return $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | # Update buffer and return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | ▶ | if ($i<@ret) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | $state->{buf} = $ret[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | $state->{pos} = length($state->{buf}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | return $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 10 | ▶ | unless (caller()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | my $c = __PACKAGE__->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 0 | ▶ | if (@ARGV) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | ▶ | while (defined(my $line = $c->readline($ARGV[0] .'> '))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | ▶ | if ($line =~ /\S/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | print eval $line, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | sub MinLine($;$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | ▶ | my $self = $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
MinLine: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | my $old = $self->{minlength}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | ▶ | $self->{minlength} = $_[1] if @_ == 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | return $old; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 10 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||