From 695488ce03c85c82d857b5c310c8edf4c0457649 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Thu, 7 Oct 2010 00:03:42 +0100 Subject: changed terminal size detection from stty to tput lines/cols --- prompt_info/prompt_replace.pl | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'prompt_info/prompt_replace.pl') 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 { -- cgit v1.2.3