Mercurial > mxe-octave
view src/readline-1-display.patch @ 4571:d5eee507aec2
freetds: update to v1.00.80
* src/freetds.mk: update version, checksum, PKG_UPDATE rule
author | John D |
---|---|
date | Tue, 05 Dec 2017 07:58:16 -0500 |
parents | 4ce61d3172f0 |
children |
line wrap: on
line source
diff -uNr a/display.c b/display.c --- a/display.c 2009-09-26 14:37:33.000000000 -0400 +++ b/display.c 2013-04-17 17:51:18.323642508 -0400 @@ -55,6 +55,11 @@ #include "rlprivate.h" #include "xmalloc.h" +#if defined (_WIN32) +#include <windows.h> +#define hStdout GetStdHandle(STD_OUTPUT_HANDLE) +#endif + #if !defined (strchr) && !defined (__STDC__) extern char *strchr (), *strrchr (); #endif /* !strchr && !__STDC__ */ @@ -1904,6 +1909,20 @@ int cpos, dpos; /* current and desired cursor positions */ int adjust; +#if defined (_WIN32) + CONSOLE_SCREEN_BUFFER_INFO csbi; + if (_rl_last_c_pos != new + && GetConsoleScreenBufferInfo (hStdout, &csbi)) + { + csbi.dwCursorPosition.X += new - _rl_last_c_pos; + if (SetConsoleCursorPosition(hStdout, csbi.dwCursorPosition)) + { + _rl_last_c_pos = new; + return; + } + } +#endif /* !_WIN32 */ + woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset); cpos = _rl_last_c_pos; @@ -2040,6 +2059,20 @@ { register int delta, i; +#if defined (_WIN32) + CONSOLE_SCREEN_BUFFER_INFO csbi; + if (_rl_last_v_pos != to && to <= _rl_screenheight + && GetConsoleScreenBufferInfo(hStdout, &csbi)) + { + csbi.dwCursorPosition.Y += to - _rl_last_v_pos; + if (SetConsoleCursorPosition(hStdout, csbi.dwCursorPosition)) + { + _rl_last_v_pos = to; + return; + } + } +#endif /* !_WIN32 */ + if (_rl_last_v_pos == to || to > _rl_screenheight) return; @@ -2318,6 +2351,17 @@ _rl_clear_to_eol (count) int count; { +#if defined (_WIN32) + CONSOLE_SCREEN_BUFFER_INFO csbi; + if (GetConsoleScreenBufferInfo (hStdout, &csbi)) + { + DWORD written; + FillConsoleOutputCharacter(hStdout, ' ', count, csbi.dwCursorPosition, + &written); + return; + } +#endif /* !_WIN32 */ + if (_rl_term_clreol) tputs (_rl_term_clreol, 1, _rl_output_character_function); else if (count) @@ -2341,6 +2385,33 @@ void _rl_clear_screen () { +#if defined (_WIN32) + COORD coordScreen = { 0, 0 }; + DWORD cCharsWritten; + CONSOLE_SCREEN_BUFFER_INFO csbi; + DWORD dwConSize; + + if (GetConsoleScreenBufferInfo (hStdout, &csbi)) + { + dwConSize = csbi.dwSize.X * csbi.dwSize.Y; + + if (FillConsoleOutputCharacter (hStdout, (TCHAR) ' ', dwConSize, + coordScreen, &cCharsWritten)) + { + if (GetConsoleScreenBufferInfo (hStdout, &csbi)) + { + if (FillConsoleOutputAttribute (hStdout, csbi.wAttributes, + dwConSize, coordScreen, + &cCharsWritten)) + { + SetConsoleCursorPosition (hStdout, coordScreen); + return; + } + } + } + } +#endif + if (_rl_term_clrpag) tputs (_rl_term_clrpag, 1, _rl_output_character_function); else