-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Use 'mode' command to detect terminal size on Windows #4594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if (defined('PHP_WINDOWS_VERSION_BUILD')) { | ||
exec('mode CON', $execData); | ||
|
||
if(preg_match('{columns:\s*(\d+)}i', $execData[4], $matches)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing space after if
ping @Seldaek |
It's a good addition, but you should still use ANSICON first if it's available. mode returns the buffer size and not the window size, which means the lines are not the real terminal height, but the buffer setting. ANSICON has both informations and hence allows you to be more correct. For columns/width both offer equally good information since the buffer size is not bigger than the window. |
Can you squash your commits before I merge? Thanks. |
Yes that's fine. |
@jcowgill there are still 3 commits. |
Woops, it's done now |
Commits ------- bb87a71 [Console] Use 'mode' command to detect terminal size on Windows Discussion ---------- [Console] Use 'mode' command to detect terminal size on Windows This PR uses the windows 'mode' command to get the terminal height and width on windows. I've left in the ANSICON stuff but I'm not sure if that's needed after this. --------------------------------------------------------------------------- by travisbot at 2012-06-16T10:37:25Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1634120) (merged a490b6ec into f881d28). --------------------------------------------------------------------------- by fabpot at 2012-06-16T16:17:24Z ping @Seldaek --------------------------------------------------------------------------- by Seldaek at 2012-06-16T17:03:22Z It's a good addition, but you should still use ANSICON first if it's available. mode returns the buffer size and not the window size, which means the lines are not the real terminal height, but the buffer setting. ANSICON has both informations and hence allows you to be more correct. For columns/width both offer equally good information since the buffer size is not bigger than the window. --------------------------------------------------------------------------- by fabpot at 2012-06-17T10:41:21Z Can you squash your commits before I merge? Thanks. --------------------------------------------------------------------------- by jcowgill at 2012-06-17T13:23:01Z Yes that's fine. --------------------------------------------------------------------------- by fabpot at 2012-06-18T12:04:43Z @jcowgill there are still 3 commits. --------------------------------------------------------------------------- by jcowgill at 2012-06-18T14:59:51Z Woops, it's done now
This PR uses the windows 'mode' command to get the terminal height and width on windows.
I've left in the ANSICON stuff but I'm not sure if that's needed after this.