Browse Source

Merge branch 'nowm-13309-incorrect-console-width-height'

tags/2.0.11
SilverFire - Dmitry Naumenko 8 years ago
parent
commit
8cce2027ad
No known key found for this signature in database
GPG Key ID: 39DD917A92B270A
  1. 2
      framework/CHANGELOG.md
  2. 14
      framework/helpers/BaseConsole.php

2
framework/CHANGELOG.md

@ -45,6 +45,8 @@ Yii Framework 2 Change Log
- Bug #13232: Event handlers were not detached with changed selector in `yii.gridView.js` (arogachev)
- Bug #12969: Improved unique ID generation for `yii\widgets\Pjax` widgets (dynasource, samdark, rob006)
- Bug #13326: Fixed wrong background color generation in `BaseConsole::renderColoredString()` (nowm, silverfire)
- Bug: #12969: Improved unique ID generation for `yii\widgets\Pjax` widgets (dynasource, samdark, rob006)
- Bug #13309: Fixes incorrect console width/height detecting with using Stty on Mac (nowm)
- Enh #475: Added Bash and Zsh completion support for the `./yii` command (cebe, silverfire)
- Enh #6242: Access to validator in inline validation (arogachev)
- Enh #6373: Introduce `yii\db\Query::emulateExecution()` to force returning an empty result for a query (klimov-paul)

14
framework/helpers/BaseConsole.php

@ -619,8 +619,18 @@ class BaseConsole
} else {
// try stty if available
$stty = [];
if (exec('stty -a 2>&1', $stty) && preg_match('/rows\s+(\d+);\s*columns\s+(\d+);/mi', implode(' ', $stty), $matches)) {
return $size = [(int)$matches[2], (int)$matches[1]];
if (exec('stty -a 2>&1', $stty)) {
$stty = implode(' ', $stty);
// Linux stty output
if (preg_match('/rows\s+(\d+);\s*columns\s+(\d+);/mi', $stty, $matches)) {
return $size = [(int)$matches[2], (int)$matches[1]];
}
// MacOS stty output
if (preg_match('/(\d+)\s+rows;\s*(\d+)\s+columns;/mi', $stty, $matches)) {
return $size = [(int)$matches[2], (int)$matches[1]];
}
}
// fallback to tput, which may not be updated on terminal resize

Loading…
Cancel
Save