Mercurial > mxe-octave
comparison src/readline-1-display.patch @ 5031:5049ab5e66f6
Re-add readline patches to work with readline 8 (Bug #55957)
* src/readline-1-display.patch, src/readline-1-input.patch,
src/readline-1-sigwinch.patch, src/readline-2-event-hook.patch
dist-files.mk: add refes to added files
author | John Donoghue |
---|---|
date | Thu, 21 Mar 2019 09:34:09 -0400 |
parents | |
children | 41e50d658de0 |
comparison
equal
deleted
inserted
replaced
5030:eec61a755122 | 5031:5049ab5e66f6 |
---|---|
1 diff -ur readline-8.0.orig/display.c readline-8.0.disp/display.c | |
2 --- readline-8.0.orig/display.c 2019-03-20 07:41:37.573786782 -0400 | |
3 +++ readline-8.0.disp/display.c 2019-03-20 17:00:29.866659451 -0400 | |
4 @@ -59,6 +59,11 @@ | |
5 #include "rlprivate.h" | |
6 #include "xmalloc.h" | |
7 | |
8 +#if defined (_WIN32) | |
9 +#include <windows.h> | |
10 +#define hStdout GetStdHandle(STD_OUTPUT_HANDLE) | |
11 +#endif | |
12 + | |
13 #if !defined (strchr) && !defined (__STDC__) | |
14 extern char *strchr (), *strrchr (); | |
15 #endif /* !strchr && !__STDC__ */ | |
16 @@ -2367,6 +2372,20 @@ | |
17 int in_invisline; | |
18 int mb_cur_max = MB_CUR_MAX; | |
19 | |
20 +#if defined (_WIN32) | |
21 + CONSOLE_SCREEN_BUFFER_INFO csbi; | |
22 + if (_rl_last_c_pos != new | |
23 + && GetConsoleScreenBufferInfo (hStdout, &csbi)) | |
24 + { | |
25 + csbi.dwCursorPosition.X += new - _rl_last_c_pos; | |
26 + if (SetConsoleCursorPosition(hStdout, csbi.dwCursorPosition)) | |
27 + { | |
28 + _rl_last_c_pos = new; | |
29 + return; | |
30 + } | |
31 + } | |
32 +#endif /* !_WIN32 */ | |
33 + | |
34 woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset); | |
35 cpos = _rl_last_c_pos; | |
36 | |
37 @@ -2519,6 +2538,20 @@ | |
38 { | |
39 register int delta, i; | |
40 | |
41 +#if defined (_WIN32) | |
42 + CONSOLE_SCREEN_BUFFER_INFO csbi; | |
43 + if (_rl_last_v_pos != to && to <= _rl_screenheight | |
44 + && GetConsoleScreenBufferInfo(hStdout, &csbi)) | |
45 + { | |
46 + csbi.dwCursorPosition.Y += to - _rl_last_v_pos; | |
47 + if (SetConsoleCursorPosition(hStdout, csbi.dwCursorPosition)) | |
48 + { | |
49 + _rl_last_v_pos = to; | |
50 + return; | |
51 + } | |
52 + } | |
53 +#endif /* !_WIN32 */ | |
54 + | |
55 if (_rl_last_v_pos == to || to > _rl_screenheight) | |
56 return; | |
57 | |
58 @@ -2848,6 +2881,17 @@ | |
59 void | |
60 _rl_clear_to_eol (int count) | |
61 { | |
62 +#if defined (_WIN32) | |
63 + CONSOLE_SCREEN_BUFFER_INFO csbi; | |
64 + if (GetConsoleScreenBufferInfo (hStdout, &csbi)) | |
65 + { | |
66 + DWORD written; | |
67 + FillConsoleOutputCharacter(hStdout, ' ', count, csbi.dwCursorPosition, | |
68 + &written); | |
69 + return; | |
70 + } | |
71 +#endif /* !_WIN32 */ | |
72 + | |
73 #ifndef __MSDOS__ | |
74 if (_rl_term_clreol) | |
75 tputs (_rl_term_clreol, 1, _rl_output_character_function); | |
76 @@ -2873,6 +2917,33 @@ | |
77 void | |
78 _rl_clear_screen (void) | |
79 { | |
80 +#if defined (_WIN32) | |
81 + COORD coordScreen = { 0, 0 }; | |
82 + DWORD cCharsWritten; | |
83 + CONSOLE_SCREEN_BUFFER_INFO csbi; | |
84 + DWORD dwConSize; | |
85 + | |
86 + if (GetConsoleScreenBufferInfo (hStdout, &csbi)) | |
87 + { | |
88 + dwConSize = csbi.dwSize.X * csbi.dwSize.Y; | |
89 + | |
90 + if (FillConsoleOutputCharacter (hStdout, (TCHAR) ' ', dwConSize, | |
91 + coordScreen, &cCharsWritten)) | |
92 + { | |
93 + if (GetConsoleScreenBufferInfo (hStdout, &csbi)) | |
94 + { | |
95 + if (FillConsoleOutputAttribute (hStdout, csbi.wAttributes, | |
96 + dwConSize, coordScreen, | |
97 + &cCharsWritten)) | |
98 + { | |
99 + SetConsoleCursorPosition (hStdout, coordScreen); | |
100 + return; | |
101 + } | |
102 + } | |
103 + } | |
104 + } | |
105 +#endif | |
106 + | |
107 #if defined (__DJGPP__) | |
108 ScreenClear (); | |
109 ScreenSetCursor (0, 0); |