aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--prompt_info/prompt_replace.pl19
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 {