mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
win32.c: fix CSI sequences to delete
* win32/win32.c (constat_apply): CSI 'J' and 'K' are defaulted to 1, not 0. [ruby-core:86560] [Bug #14691] * win32/win32.c (constat_apply): "delete before cursor" sequences include the cursor position. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0f6a665484
commit
55d3ed4b9d
1 changed files with 8 additions and 8 deletions
|
@ -6679,11 +6679,11 @@ constat_apply(HANDLE handle, struct constat *s, WCHAR w)
|
||||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||||
const int *seq = s->vt100.seq;
|
const int *seq = s->vt100.seq;
|
||||||
int count = s->vt100.state;
|
int count = s->vt100.state;
|
||||||
int arg1 = 1;
|
int arg0, arg1 = 1;
|
||||||
COORD pos;
|
COORD pos;
|
||||||
|
|
||||||
if (!GetConsoleScreenBufferInfo(handle, &csbi)) return;
|
if (!GetConsoleScreenBufferInfo(handle, &csbi)) return;
|
||||||
if (count > 0 && seq[0] > 0) arg1 = seq[0];
|
if (arg0 = (count > 0 && seq[0] > 0)) arg1 = seq[0];
|
||||||
switch (w) {
|
switch (w) {
|
||||||
case L'm':
|
case L'm':
|
||||||
SetConsoleTextAttribute(handle, constat_attr(count, seq, csbi.wAttributes, s->vt100.attr, &s->vt100.reverse));
|
SetConsoleTextAttribute(handle, constat_attr(count, seq, csbi.wAttributes, s->vt100.attr, &s->vt100.reverse));
|
||||||
|
@ -6742,19 +6742,19 @@ constat_apply(HANDLE handle, struct constat *s, WCHAR w)
|
||||||
SetConsoleCursorPosition(handle, pos);
|
SetConsoleCursorPosition(handle, pos);
|
||||||
break;
|
break;
|
||||||
case L'J':
|
case L'J':
|
||||||
switch (arg1) {
|
switch (arg0 ? arg1 : 0) {
|
||||||
case 0: /* erase after cursor */
|
case 0: /* erase after cursor */
|
||||||
constat_clear(handle, csbi.wAttributes,
|
constat_clear(handle, csbi.wAttributes,
|
||||||
(csbi.dwSize.X * (csbi.srWindow.Bottom - csbi.dwCursorPosition.Y + 1)
|
(csbi.dwSize.X * (csbi.srWindow.Bottom - csbi.dwCursorPosition.Y + 1)
|
||||||
- csbi.dwCursorPosition.X),
|
- csbi.dwCursorPosition.X),
|
||||||
csbi.dwCursorPosition);
|
csbi.dwCursorPosition);
|
||||||
break;
|
break;
|
||||||
case 1: /* erase before cursor */
|
case 1: /* erase before *and* cursor */
|
||||||
pos.X = 0;
|
pos.X = 0;
|
||||||
pos.Y = csbi.srWindow.Top;
|
pos.Y = csbi.srWindow.Top;
|
||||||
constat_clear(handle, csbi.wAttributes,
|
constat_clear(handle, csbi.wAttributes,
|
||||||
(csbi.dwSize.X * (csbi.dwCursorPosition.Y - csbi.srWindow.Top)
|
(csbi.dwSize.X * (csbi.dwCursorPosition.Y - csbi.srWindow.Top)
|
||||||
+ csbi.dwCursorPosition.X),
|
+ csbi.dwCursorPosition.X + 1),
|
||||||
pos);
|
pos);
|
||||||
break;
|
break;
|
||||||
case 2: /* erase entire screen */
|
case 2: /* erase entire screen */
|
||||||
|
@ -6774,17 +6774,17 @@ constat_apply(HANDLE handle, struct constat *s, WCHAR w)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case L'K':
|
case L'K':
|
||||||
switch (arg1) {
|
switch (arg0 ? arg1 : 0) {
|
||||||
case 0: /* erase after cursor */
|
case 0: /* erase after cursor */
|
||||||
constat_clear(handle, csbi.wAttributes,
|
constat_clear(handle, csbi.wAttributes,
|
||||||
(csbi.dwSize.X - csbi.dwCursorPosition.X),
|
(csbi.dwSize.X - csbi.dwCursorPosition.X),
|
||||||
csbi.dwCursorPosition);
|
csbi.dwCursorPosition);
|
||||||
break;
|
break;
|
||||||
case 1: /* erase before cursor */
|
case 1: /* erase before *and* cursor */
|
||||||
pos.X = 0;
|
pos.X = 0;
|
||||||
pos.Y = csbi.dwCursorPosition.Y;
|
pos.Y = csbi.dwCursorPosition.Y;
|
||||||
constat_clear(handle, csbi.wAttributes,
|
constat_clear(handle, csbi.wAttributes,
|
||||||
csbi.dwCursorPosition.X, pos);
|
csbi.dwCursorPosition.X + 1, pos);
|
||||||
break;
|
break;
|
||||||
case 2: /* erase entire line */
|
case 2: /* erase entire line */
|
||||||
pos.X = 0;
|
pos.X = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue