1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fixed commit miss at 19cc24b34b

This commit is contained in:
Nobuyoshi Nakada 2021-02-23 20:46:40 +09:00
parent da18d6f015
commit 41eb4fbf86
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -6591,36 +6591,32 @@ constat_handle(HANDLE h)
{ {
st_data_t data; st_data_t data;
struct constat *p; struct constat *p;
EnterCriticalSection(&conlist_mutex);
if (!conlist) { if (!conlist) {
if (console_emulator_p()) { if (console_emulator_p()) {
conlist = conlist_disabled; conlist = conlist_disabled;
} else { return NULL;
conlist = st_init_numtable();
install_vm_exit_handler();
} }
conlist = st_init_numtable();
install_vm_exit_handler();
} }
if (conlist != conlist_disabled) { else if (conlist == conlist_disabled) {
if (st_lookup(conlist, (st_data_t)h, &data)) { return NULL;
p = (struct constat *)data; }
} else { if (st_lookup(conlist, (st_data_t)h, &data)) {
CONSOLE_SCREEN_BUFFER_INFO csbi; p = (struct constat *)data;
p = ALLOC(struct constat); }
p->vt100.state = constat_init; else {
p->vt100.attr = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED; CONSOLE_SCREEN_BUFFER_INFO csbi;
p->vt100.reverse = 0; p = ALLOC(struct constat);
p->vt100.saved.X = p->vt100.saved.Y = 0; p->vt100.state = constat_init;
if (GetConsoleScreenBufferInfo(h, &csbi)) { p->vt100.attr = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED;
p->vt100.attr = csbi.wAttributes; p->vt100.reverse = 0;
} p->vt100.saved.X = p->vt100.saved.Y = 0;
st_insert(conlist, (st_data_t)h, (st_data_t)p); if (GetConsoleScreenBufferInfo(h, &csbi)) {
p->vt100.attr = csbi.wAttributes;
} }
} else { st_insert(conlist, (st_data_t)h, (st_data_t)p);
p = NULL;
} }
LeaveCriticalSection(&conlist_mutex);
return p; return p;
} }
@ -6630,16 +6626,12 @@ constat_reset(HANDLE h)
{ {
st_data_t data; st_data_t data;
struct constat *p; struct constat *p;
thread_exclusive(conlist) {
EnterCriticalSection(&conlist_mutex); if (!conlist || conlist == conlist_disabled) continue;
if ( if (!st_lookup(conlist, (st_data_t)h, &data)) continue;
conlist && conlist != conlist_disabled &&
st_lookup(conlist, (st_data_t)h, &data)
) {
p = (struct constat *)data; p = (struct constat *)data;
p->vt100.state = constat_init; p->vt100.state = constat_init;
} }
LeaveCriticalSection(&conlist_mutex);
} }
#define FOREGROUND_MASK (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY) #define FOREGROUND_MASK (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY)