ansiterm fix: use FillConsoleOutputCharacterW instead of FillConsoleOutputCharacterA

This commit is contained in:
Thomas Nagy 2014-01-25 19:59:51 +01:00
parent 9a824a5649
commit 1b534ee8d2
1 changed files with 6 additions and 7 deletions

View File

@ -17,7 +17,7 @@ from waflib.Utils import threading
wlock = threading.Lock()
try:
from ctypes import Structure, windll, c_short, c_ushort, c_ulong, c_int, byref, c_char, POINTER, c_long
from ctypes import Structure, windll, c_short, c_ushort, c_ulong, c_int, byref, c_wchar, POINTER, c_long
except ImportError:
class AnsiTerm(object):
@ -71,8 +71,8 @@ else:
windll.kernel32.GetConsoleScreenBufferInfo.restype = c_long
windll.kernel32.SetConsoleTextAttribute.argtypes = [c_ulong, c_ushort]
windll.kernel32.SetConsoleTextAttribute.restype = c_long
windll.kernel32.FillConsoleOutputCharacterA.argtypes = [c_ulong, c_char, c_ulong, POINTER(COORD), POINTER(c_ulong)]
windll.kernel32.FillConsoleOutputCharacterA.restype = c_long
windll.kernel32.FillConsoleOutputCharacterW.argtypes = [c_ulong, c_wchar, c_ulong, POINTER(COORD), POINTER(c_ulong)]
windll.kernel32.FillConsoleOutputCharacterW.restype = c_long
windll.kernel32.FillConsoleOutputAttribute.argtypes = [c_ulong, c_ushort, c_ulong, POINTER(COORD), POINTER(c_ulong) ]
windll.kernel32.FillConsoleOutputAttribute.restype = c_long
windll.kernel32.SetConsoleCursorPosition.argtypes = [c_ulong, POINTER(COORD) ]
@ -126,7 +126,7 @@ else:
line_start = sbinfo.CursorPosition
line_length = sbinfo.Size.X - sbinfo.CursorPosition.X
chars_written = c_ulong()
windll.kernel32.FillConsoleOutputCharacterA(self.hconsole, c_char(' '), line_length, line_start, byref(chars_written))
windll.kernel32.FillConsoleOutputCharacterW(self.hconsole, c_wchar(' '), line_length, line_start, byref(chars_written))
windll.kernel32.FillConsoleOutputAttribute(self.hconsole, sbinfo.Attributes, line_length, line_start, byref(chars_written))
def clear_screen(self, param):
@ -143,7 +143,7 @@ else:
clear_start = sbinfo.CursorPosition
clear_length = ((sbinfo.Size.X - sbinfo.CursorPosition.X) + sbinfo.Size.X * (sbinfo.Size.Y - sbinfo.CursorPosition.Y))
chars_written = c_ulong()
windll.kernel32.FillConsoleOutputCharacterA(self.hconsole, c_char(' '), clear_length, clear_start, byref(chars_written))
windll.kernel32.FillConsoleOutputCharacterW(self.hconsole, c_wchar(' '), clear_length, clear_start, byref(chars_written))
windll.kernel32.FillConsoleOutputAttribute(self.hconsole, sbinfo.Attributes, clear_length, clear_start, byref(chars_written))
def push_cursor(self, param):
@ -294,8 +294,7 @@ else:
sbinfo = CONSOLE_SCREEN_BUFFER_INFO()
def get_term_cols():
windll.kernel32.GetConsoleScreenBufferInfo(console, byref(sbinfo))
# TODO Issue 1401
return sbinfo.Size.X - 1
return sbinfo.Size.X
# just try and see
try: