line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Term::Completion::_readkey;
|
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
77
|
|
4
|
2
|
|
|
2
|
|
935
|
use Term::ReadKey qw(ReadMode ReadKey GetTerminalSize);
|
|
2
|
|
|
|
|
13170
|
|
|
2
|
|
|
|
|
794
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub set_raw_tty
|
7
|
|
|
|
|
|
|
{
|
8
|
1
|
|
|
1
|
1
|
9
|
my __PACKAGE__ $this = shift;
|
9
|
1
|
50
|
|
|
|
19
|
ReadMode 4, $this->{in} if -t $this->{in};
|
10
|
1
|
|
|
|
|
4
|
1;
|
11
|
|
|
|
|
|
|
}
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub reset_tty
|
14
|
|
|
|
|
|
|
{
|
15
|
1
|
|
|
1
|
1
|
11
|
my __PACKAGE__ $this = shift;
|
16
|
1
|
50
|
|
|
|
7
|
ReadMode 0, $this->{in} if -t $this->{in};
|
17
|
1
|
|
|
|
|
2
|
1;
|
18
|
|
|
|
|
|
|
}
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub get_key
|
21
|
|
|
|
|
|
|
{
|
22
|
0
|
|
|
0
|
1
|
0
|
my __PACKAGE__ $this = shift;
|
23
|
0
|
|
|
|
|
0
|
ReadKey(0, $this->{in});
|
24
|
|
|
|
|
|
|
}
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
if($^O =~ /interix|win/i) {
|
27
|
|
|
|
|
|
|
require Term::Completion::_termsize;
|
28
|
|
|
|
|
|
|
*get_term_size = \&Term::Completion::_termsize::get_term_size;
|
29
|
|
|
|
|
|
|
} else {
|
30
|
|
|
|
|
|
|
*get_term_size = sub {
|
31
|
1
|
|
|
1
|
|
540
|
my __PACKAGE__ $this = shift;
|
32
|
1
|
50
|
33
|
|
|
7
|
if(defined $this->{columns} and defined $this->{rows}) {
|
33
|
0
|
|
|
|
|
0
|
return($this->{columns}, $this->{rows});
|
34
|
|
|
|
|
|
|
}
|
35
|
1
|
|
|
|
|
7
|
my ($c,$r) = GetTerminalSize($this->{out});
|
36
|
1
|
|
33
|
|
|
17934
|
$c ||= $Term::Completion::DEFAULTS{columns};
|
37
|
1
|
|
33
|
|
|
31
|
$r ||= $Term::Completion::DEFAULTS{rows};
|
38
|
|
|
|
|
|
|
return (
|
39
|
1
|
50
|
|
|
|
45
|
(defined $this->{columns} ? $this->{columns} : $c),
|
|
|
50
|
|
|
|
|
|
40
|
|
|
|
|
|
|
(defined $this->{rows} ? $this->{rows} : $r)
|
41
|
|
|
|
|
|
|
);
|
42
|
|
|
|
|
|
|
};
|
43
|
|
|
|
|
|
|
}
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1;
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__
|