Commit e4c330e3 authored by Ralf Becker's avatar Ralf Becker

ZP-704 z-push-top screen-size calculation fails under OS X. Released under the...

ZP-704 z-push-top screen-size calculation fails under OS X. Released under the Affero GNU General Public License (AGPL) version 3.
parent 6cfaf59b
...@@ -670,7 +670,7 @@ class ZPushTop { ...@@ -670,7 +670,7 @@ class ZPushTop {
/** /**
* Pads and trims string * Pads and trims string
* *
* @param string $string to be trimmed/padded * @param string $str to be trimmed/padded
* @param int $size characters to be considered * @param int $size characters to be considered
* @param boolean $cutmiddle (optional) indicates where to long information should * @param boolean $cutmiddle (optional) indicates where to long information should
* be trimmed of, false means at the end * be trimmed of, false means at the end
...@@ -697,8 +697,9 @@ class ZPushTop { ...@@ -697,8 +697,9 @@ class ZPushTop {
* @return array 'width' and 'height' as keys * @return array 'width' and 'height' as keys
*/ */
private function scrGetSize() { private function scrGetSize() {
preg_match_all("/rows.([0-9]+);.columns.([0-9]+);/", strtolower(exec('stty -a | fgrep columns')), $output); $tty = strtolower(exec('stty -a | fgrep columns'));
if(sizeof($output) == 3) if (preg_match_all("/rows.([0-9]+);.columns.([0-9]+);/", $tty, $output) ||
preg_match_all("/([0-9]+).rows;.([0-9]+).columns;/", $tty, $output))
return array('width' => $output[2][0], 'height' => $output[1][0]); return array('width' => $output[2][0], 'height' => $output[1][0]);
return array('width' => 80, 'height' => 24); return array('width' => 80, 'height' => 24);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment