[svn r62857] Always substract the last column from the Win32 terminal console:
otherwise the last char wraps and the \n causes an empty line. This allows more tests to pass. --HG-- branch : trunk
This commit is contained in:
parent
4be27f5078
commit
f56310d178
|
@ -63,7 +63,9 @@ if sys.platform == 'win32':
|
|||
info = CONSOLE_SCREEN_BUFFER_INFO()
|
||||
ctypes.windll.kernel32.GetConsoleScreenBufferInfo(
|
||||
handle, ctypes.byref(info))
|
||||
return info.dwSize.Y, info.dwSize.X
|
||||
# Substract one from the width, otherwise the cursor wraps
|
||||
# and the ending \n causes an empty line to display.
|
||||
return info.dwSize.Y, info.dwSize.X - 1
|
||||
|
||||
def get_terminal_width():
|
||||
try:
|
||||
|
@ -218,9 +220,6 @@ class Win32ConsoleWriter(object):
|
|||
def sep(self, sepchar, title=None, fullwidth=None, **kw):
|
||||
if fullwidth is None:
|
||||
fullwidth = self.fullwidth
|
||||
# On a Windows console, writing in the last column
|
||||
# causes a line feed.
|
||||
fullwidth -= 1
|
||||
# the goal is to have the line be as long as possible
|
||||
# under the condition that len(line) <= fullwidth
|
||||
if title is not None:
|
||||
|
|
|
@ -40,7 +40,6 @@ class BaseTests:
|
|||
tw.sep("-", fullwidth=60)
|
||||
l = self.getlines()
|
||||
assert len(l) == 1
|
||||
skip_win32()
|
||||
assert l[0] == "-" * 60 + "\n"
|
||||
|
||||
def test_sep_with_title(self):
|
||||
|
@ -48,7 +47,6 @@ class BaseTests:
|
|||
tw.sep("-", "hello", fullwidth=60)
|
||||
l = self.getlines()
|
||||
assert len(l) == 1
|
||||
skip_win32()
|
||||
assert l[0] == "-" * 26 + " hello " + "-" * 27 + "\n"
|
||||
|
||||
def test__escaped(self):
|
||||
|
|
Loading…
Reference in New Issue