Commit f719c744 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #57 in ZP/z-push from...

Merge pull request #57 in ZP/z-push from bugfix/ZP-704-z-push-top-screen-size-calculation-fails-under-OS-X to develop

* commit '27454aad':
  ZP-704 Fixed white space.
  ZP-704 z-push-top screen-size calculation fails under OS X. Released under the Affero GNU General Public License (AGPL) version 3.

(cherry picked from commit ba460f57)
parent 0f72b085
...@@ -671,7 +671,7 @@ class ZPushTop { ...@@ -671,7 +671,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
...@@ -698,8 +698,9 @@ class ZPushTop { ...@@ -698,8 +698,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);
...@@ -771,4 +772,4 @@ class ZPushTop { ...@@ -771,4 +772,4 @@ class ZPushTop {
} }
?> ?>
\ No newline at end of file
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