Skip to content

Commit b28bc1f

Browse files
committed
Manual Merge change 4e76517
ID Author Date Message 4e76517 Ray Hayes <[email protected]> 9/20/2016 9:07:50 PM -07:00 Fixes to handle bash formatting on Windows
1 parent d0ea7fc commit b28bc1f

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

contrib/win32/win32compat/ansiprsr.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ unsigned char* ParseBuffer(unsigned char* pszBuffer, unsigned char* pszBufferEnd
188188
if (pszCurrent == pszNewCurrent) // Pointer didn't move inside Parse function
189189
{
190190
pszNewCurrent += ConWriteString( (char *)pszCurrent, 1);
191-
return pszBuffer + 1;
191+
return pszNewCurrent;
192192
}
193193
if (pszNewCurrent > pszCurrent)
194194
pszBuffer = pszNewCurrent;
@@ -250,8 +250,8 @@ unsigned char* ParseBuffer(unsigned char* pszBuffer, unsigned char* pszBufferEnd
250250
case 10:
251251
pszBuffer++;
252252
AutoWrap = 1;
253-
GoToNextLine();
254-
break;
253+
bAtEOLN = TRUE;
254+
break;
255255

256256
case 12:
257257
pszBuffer++;
@@ -869,7 +869,7 @@ unsigned char * ParseANSI(unsigned char * pszBuffer, unsigned char * pszBufferEn
869869
bCS1 = 0;
870870
bBkMode = 0;
871871
bCharMode = 0;
872-
return pszCurrent;
872+
return pszCurrent;
873873
}
874874
else
875875
return pszBuffer;
@@ -912,9 +912,9 @@ unsigned char * ParseVT52(unsigned char * pszBuffer, unsigned char * pszBufferEn
912912
break;
913913

914914
case 'H': // Cursor Home
915-
ConSetCursorPosition(0, 0);
915+
ConSetCursorPosition(1, 1);
916916
pszCurrent++;
917-
bAtEOLN = FALSE;
917+
bAtEOLN = FALSE;
918918
break;
919919
case 'I': // Reverse Line Feed
920920
pszCurrent++;

contrib/win32/win32compat/shell-host.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void SendCharacter(HANDLE hInput, WORD attributes, char character) {
227227

228228
char formatted_output[2048];
229229

230-
static USHORT pColor = 0;
230+
static WORD pattributes = 0;
231231

232232
USHORT Color = 0;
233233
ULONG Status = 0;
@@ -305,10 +305,12 @@ void SendCharacter(HANDLE hInput, WORD attributes, char character) {
305305

306306
StringCbPrintfExA(Next, SizeLeft, &Next, &SizeLeft, 0, "m", Color);
307307

308-
if (bUseAnsiEmulation && Color != pColor)
308+
if (bUseAnsiEmulation && attributes != pattributes)
309309
WriteFile(hInput, formatted_output, (Next - formatted_output), &wr, NULL);
310310

311311
WriteFile(hInput, &character, 1, &wr, NULL);
312+
313+
pattributes = attributes;
312314
}
313315

314316
void SendBuffer(HANDLE hInput, CHAR_INFO *buffer, DWORD bufferSize) {

0 commit comments

Comments
 (0)