You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
The library uses the wrong terminal width on windows so here is some code for
finding it:
def get_windows_term_width():
from ctypes import windll, create_string_buffer
h = windll.kernel32.GetStdHandle(-12)
csbi = create_string_buffer(22)
res = windll.kernel32.GetConsoleScreenBufferInfo(h, csbi)
if res:
import struct
(bufx, bufy, curx, cury, wattr,
left, top, right, bottom, maxx, maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw)
sizex = right - left + 1
else:
sizex = 80
return sizex
Your library really rocks btw!
Original issue reported on code.google.com by bjou...@gmail.com on 30 May 2011 at 9:02
The text was updated successfully, but these errors were encountered:
Both of you are cool. FYI get_windows_term_width's working report is following.
Every test runs on Windows XP SP3 x86.
Regards!
* Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
-> Works well with no fix.
* IronPython 2.7 (2.7.0.40) on .NET 4.0.30319.225
-> Works well with some fix.
IronPython doesn't allow such syntax of new line.
----
[BEFORE]
(bufx, bufy, curx, cury, wattr,
left, top, right, bottom, maxx, maxy)
[AFTER]
(bufx, bufy, curx, cury, wattr,left, top, right, bottom, maxx, maxy)
----
* Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)[GCC 4.3.4 20090804 (release)
1] on cygwin
-> Doesn't work, but cygwin's os.name returns 'posix'. So no problem.
----
ImportError: cannot import name windll
----
Original comment by sakurai....@gmail.com on 10 Jun 2011 at 6:59
Original issue reported on code.google.com by
bjou...@gmail.com
on 30 May 2011 at 9:02The text was updated successfully, but these errors were encountered: