8000 [Console] Use 'mode' command to detect terminal size on Windows by jcowgill · Pull Request #4594 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[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

Merged
merged 1 commit into from
Jun 18, 2012
Merged

[Console] Use 'mode' command to detect terminal size on Windows #4594

merged 1 commit into from
Jun 18, 2012

Conversation

jcowgill
Copy link
Contributor

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.

if (defined('PHP_WINDOWS_VERSION_BUILD')) {
exec('mode CON', $execData);

if(preg_match('{columns:\s*(\d+)}i', $execData[4], $matches)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space after if

@travisbot
Copy link

This pull request passes (merged a490b6ec into f881d28).

@fabpot
Copy link
Member
fabpot commented Jun 16, 2012

ping @Seldaek

@Seldaek
Copy link
Member
Seldaek commented Jun 16, 2012

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.

@fabpot
Copy link
Member
fabpot commented Jun 17, 2012

Can you squash your commits before I merge? Thanks.

@jcowgill
Copy link
Contributor Author

Yes that's fine.

@fabpot
Copy link
Member
fabpot commented Jun 18, 2012

@jcowgill there are still 3 commits.

@jcowgill
Copy link
Contributor Author

Woops, it's done now

fabpot added a commit that referenced this pull request Jun 18, 2012
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
@fabpot fabpot merged commit bb87a71 into symfony:master Jun 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0