This commit is contained in:
Manoj Ampalam 2016-09-30 13:22:26 -07:00
commit 59a0cf6881

View File

@ -55,6 +55,8 @@ int ScreenX;
int ScreenY; int ScreenY;
int ScrollTop; int ScrollTop;
int ScrollBottom; int ScrollBottom;
int LastCursorX;
int LastCursorY;
char *pSavedScreen = NULL; char *pSavedScreen = NULL;
static COORD ZeroCoord = {0,0}; static COORD ZeroCoord = {0,0};
@ -1141,7 +1143,7 @@ void ConScrollUp(int topline,int botline)
Fill.Attributes = ConsoleInfo.wAttributes; Fill.Attributes = ConsoleInfo.wAttributes;
Fill.Char.AsciiChar = ' '; Fill.Char.AsciiChar = ' ';
ScrollConsoleScreenBuffer( hOutputConsole, BOOL bRet = ScrollConsoleScreenBuffer( hOutputConsole,
&ScrollRect, &ScrollRect,
&ClipRect, &ClipRect,
destination, destination,
@ -1185,7 +1187,7 @@ void ConScrollDown(int topline,int botline)
Fill.Attributes = ConsoleInfo.wAttributes; Fill.Attributes = ConsoleInfo.wAttributes;
Fill.Char.AsciiChar = ' '; Fill.Char.AsciiChar = ' ';
ScrollConsoleScreenBuffer( hOutputConsole, BOOL bRet = ScrollConsoleScreenBuffer( hOutputConsole,
&ScrollRect, &ScrollRect,
NULL, NULL,
destination, destination,
@ -1224,8 +1226,20 @@ void ConSetCursorPosition(int x, int y)
Coord.X = (short)(x); Coord.X = (short)(x);
Coord.Y = (short)(y); Coord.Y = (short)(y);
if ((y > ConsoleInfo.dwSize.Y - 1) && y > LastCursorY) {
for(int n = LastCursorY; n < y; n++)
GoToNextLine();
}
if (y >= ConsoleInfo.dwSize.Y) {
Coord.Y = ConsoleInfo.dwSize.Y - 1;
}
if (!SetConsoleCursorPosition(hOutputConsole, Coord)) if (!SetConsoleCursorPosition(hOutputConsole, Coord))
rc = GetLastError(); rc = GetLastError();
LastCursorX = x;
LastCursorY = y;
} }
BOOL ConChangeCursor( CONSOLE_CURSOR_INFO *pCursorInfo ) BOOL ConChangeCursor( CONSOLE_CURSOR_INFO *pCursorInfo )