ZF-7998: Windows console (cmd) can have arbitrary width


On the page… is written:

"[NOTE] Automatic console width recognition

shell_exec is required for this feature to work on *nix based systems. On windows, there is always a fixed terminal width of 80 character, so no recognition is required there."

But it is not true - also a windows console (cmd) can have arbitrary width! Try: - run cmd - right click on the window bar (top of the window) - choose 'Properties' (the last item in pop-up menu) - go to 3rd tab (I don't know, what's the english original :( maybe 'Layout'? ) - there you can tune 'buffer size' and the 'window size'.

So, I assume, that this misinformation affected not only documentation, but also the code of Zend_ProgressBar_Adapter_Console.


Interesting, didn't know that. Do you have an idea how to recognize the window width? Else I'll google around a bit myself.

Unfortunatelly I don't have any idea :( But maybe you can try find information also about Windows PowerShell - more sophisticated shell than cmd. I think, it could offer some way, how to obtain window size, and maybe there could be some reference, how it is possible (or impossible) to get window size also for cmd window.

When cmd.exe is started, you can type "mode con" which will give something like:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Robert>mode con

Status for device CON:
    Lines:          300
    Columns:        80
    Keyboard rate:  31
    Keyboard delay: 1
    Code page:      437

C:\Documents and Settings\Robert>

The "Columns" is the screen buffer height and the "Lines" is the screen buffer width.

One can change those two values by executing something like:

mode con: lines=20 cols=50

this is only for the active window only and for the active session only, e.g., default values will be used on next startup. Also, when this is executed, the scrollbar is gone and the window resize/maximize feature is not working.

If you want to execute "mode con" right on cmd.exe's startup, run it like:

cmd.exe /k mode con


Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.