Mercurial > mxe-octave
view src/readline-1-display.patch @ 6257:a09bdc36cc34 release octave-rc-7.1.90
Update version numbers and build rules for Octave 7.1.90 release candidate.
* src/stable-octave.mk: Update version to 7.1.91.
* src/release-octave.mk: Update version to 7.1.90. Update checksum
and URL for release candidate.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 13 Jun 2022 14:33:47 -0400 |
parents | 41e50d658de0 |
children |
line wrap: on
line source
diff -ur readline-8.1.orig/display.c readline-8.1/display.c --- readline-8.1.orig/display.c 2020-12-19 07:41:44.122860975 -0500 +++ readline-8.1/display.c 2020-12-19 07:52:09.009050414 -0500 @@ -59,6 +59,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__ */ @@ -2686,6 +2691,20 @@ int in_invisline; int mb_cur_max = MB_CUR_MAX; +#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; @@ -2832,6 +2851,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; @@ -3157,6 +3190,17 @@ void _rl_clear_to_eol (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 */ + #ifndef __MSDOS__ if (_rl_term_clreol) tputs (_rl_term_clreol, 1, _rl_output_character_function); @@ -3182,6 +3226,33 @@ void _rl_clear_screen (int clrscr) { +#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 defined (__DJGPP__) ScreenClear (); ScreenSetCursor (0, 0);