diff options
author | Tom Feist <shabble@metavore.org> | 2010-10-06 23:03:42 +0000 |
---|---|---|
committer | Tom Feist <shabble@metavore.org> | 2010-10-06 23:03:42 +0000 |
commit | 695488ce03c85c82d857b5c310c8edf4c0457649 (patch) | |
tree | fc9facfcff8156a16603622fd2e502e0fc694ef1 /prompt_info/prompt_replace.pl | |
parent | added /print_test to check rev. video stuff is behaving. (diff) | |
download | irssi-scripts-695488ce03c85c82d857b5c310c8edf4c0457649.tar.gz irssi-scripts-695488ce03c85c82d857b5c310c8edf4c0457649.zip |
changed terminal size detection from stty to tput lines/cols
Diffstat (limited to 'prompt_info/prompt_replace.pl')
-rw-r--r-- | prompt_info/prompt_replace.pl | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/prompt_info/prompt_replace.pl b/prompt_info/prompt_replace.pl index 7c8ecc1..19fa022 100644 --- a/prompt_info/prompt_replace.pl +++ b/prompt_info/prompt_replace.pl @@ -39,17 +39,14 @@ init(); sub update_terminal_size { - my @stty_lines = qx/stty -a/; - my $line = $stty_lines[0]; - @stty_lines = (); # don't need the rest. - - if ($line =~ m/\s*(\d+)\s*rows\s*;\s*(\d+)\s*columns\s*;/) { - $term_h = $1; - $term_w = $2; - print "terminal size detected as $term_w x $term_h" if DEBUG; - } else { - print "Failed to detect terminal size" if DEBUG; - } + + my $rows = qx/tput lines/; + my $cols = qx/tput cols/; + chomp $rows; + chomp $cols; + + $term_w = $cols; + $term_h = $rows; } sub prompt_subcmd_handler { |