Skip to content

Commit

Permalink
Work around a regression in Windows 7, causing erase_in_line() to cra…
Browse files Browse the repository at this point in the history
…sh sometimes

The function FillConsoleOutputCharacterA() was pretty content in XP to take a NULL
pointer if we did not want to store the number of written columns.  In Windows 7,
it crashes, but only when called from within Git Bash, not from within cmd.exe.
Go figure.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Jun 1, 2009
1 parent 900a5d0 commit 492f709
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compat/winansi.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,15 @@ static void set_console_attr(void)
static void erase_in_line(void)
{
CONSOLE_SCREEN_BUFFER_INFO sbi;
DWORD dummy; /* Needed for Windows 7 (or Vista) regression */

if (!console)
return;

GetConsoleScreenBufferInfo(console, &sbi);
FillConsoleOutputCharacterA(console, ' ',
sbi.dwSize.X - sbi.dwCursorPosition.X, sbi.dwCursorPosition,
NULL);
&dummy);
}


Expand Down

0 comments on commit 492f709

Please sign in to comment.