Skip to content

Commit 3e23785

Browse files
committed
Manual Merge change f26780e
ID Author Date Message f26780e Ray Hayes <[email protected]> 9/16/2016 3:26:06 PM -07:00 Fix ESC character parsing when # missing.
1 parent d81a983 commit 3e23785

File tree

3 files changed

+523
-514
lines changed

3 files changed

+523
-514
lines changed

contrib/win32/win32compat/ansiprsr.c

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@
5252
TelParams Parameters;
5353

5454
extern int ScreenX;
55-
extern int ScreenY;
55+
extern int ScreenY;
5656
extern int ScrollTop;
5757
extern int ScrollBottom;
58+
5859
// end of imports from outside module
5960

6061
bool gbVTAppMode = false;
@@ -80,7 +81,8 @@ int bCS0 = 0;
8081
int bCS1 = 0;
8182
int bBkMode = 0;
8283
int bCharMode = 0;
83-
84+
int ReportedX = 0;
85+
int ReportedY = 0;
8486

8587
BOOL fShiftOut = FALSE;
8688
BOOL InPrintMode = FALSE;
@@ -544,6 +546,8 @@ unsigned char * ParseANSI(unsigned char * pszBuffer, unsigned char * pszBufferEn
544546
if (bMode & MODE_BRK)
545547
{
546548
// Cursor left
549+
if (iParam[0] == 0)
550+
iParam[0] = 1;
547551
ConMoveCursorPosition(-iParam[0], 0);
548552
}
549553
else if (bMode == 0)
@@ -570,15 +574,27 @@ unsigned char * ParseANSI(unsigned char * pszBuffer, unsigned char * pszBufferEn
570574
break;
571575

572576
case 'h':
577+
if (bMode & MODE_EXT)
578+
{
579+
if (iParam[0] == 4 && iParam[1] == 7) {
580+
ConSaveScreen();
581+
}
582+
}
573583
case 'l': // ^[?25h
574584
if (bMode & MODE_EXT)
575585
{
576-
if (iParam[0] == 4) {
577-
VTMode |= MODE_IRM_INSERT;
578-
}
579-
int i;
580-
for ( i = 0; i < iCurrentParam; i++ )
581-
ConSetExtendedMode(iParam[i], *pszCurrent=='h' ? 1 : 0);
586+
if (iParam[0] == 4 && iParam[1] == 7) {
587+
ConRestoreScreen();
588+
}
589+
else
590+
{
591+
if (iParam[0] == 4) {
592+
VTMode |= MODE_IRM_INSERT;
593+
}
594+
int i;
595+
for (i = 0; i < iCurrentParam; i++)
596+
ConSetExtendedMode(iParam[i], *pszCurrent == 'h' ? 1 : 0);
597+
}
582598
}
583599
else if (bMode & MODE_BRK)
584600
{
@@ -618,12 +634,14 @@ unsigned char * ParseANSI(unsigned char * pszBuffer, unsigned char * pszBufferEn
618634
ConSetAttribute(iParam, iCurrentParam);
619635
fcompletion = 1;
620636
break;
621-
622637
case 'r':
623638
fcompletion = 1;
624639
break;
625-
626-
case 'H':
640+
case 'R':
641+
ReportedX = iParam[1];
642+
ReportedY = iParam[0];
643+
break;
644+
case 'H':
627645
case 'f':
628646
if (bMode & MODE_BRK)
629647
{

0 commit comments

Comments
 (0)