Browse Source

uv: Upgrade to f89125e

v0.10.0-release
isaacs 12 years ago
parent
commit
f23ec6b3cf
  1. 1
      deps/uv/include/uv-private/uv-win.h
  2. 26
      deps/uv/src/win/tty.c

1
deps/uv/include/uv-private/uv-win.h

@ -446,7 +446,6 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
HANDLE read_line_handle; \
uv_buf_t read_line_buffer; \
HANDLE read_raw_wait; \
DWORD original_console_mode; \
/* Fields used for translating win keystrokes into vt100 characters */ \
char last_key[8]; \
unsigned char last_key_offset; \

26
deps/uv/src/win/tty.c

@ -97,7 +97,6 @@ void uv_console_init() {
int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) {
HANDLE handle = INVALID_HANDLE_VALUE;
DWORD original_console_mode = 0;
CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info;
handle = (HANDLE) _get_osfhandle(fd);
@ -106,14 +105,7 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) {
return -1;
}
if (readable) {
/* Try to obtain the original console mode fromt he input handle. */
if (!GetConsoleMode(handle, &original_console_mode)) {
uv__set_sys_error(loop, GetLastError());
return -1;
}
} else {
if (!readable) {
/* Obtain the screen buffer info with the output handle. */
if (!GetConsoleScreenBufferInfo(handle, &screen_buffer_info)) {
uv__set_sys_error(loop, GetLastError());
@ -144,7 +136,6 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) {
if (readable) {
/* Initialize TTY input specific fields. */
tty->original_console_mode = original_console_mode;
tty->flags |= UV_HANDLE_TTY_READABLE | UV_HANDLE_READABLE;
tty->read_line_handle = NULL;
tty->read_line_buffer = uv_null_buf_;
@ -175,7 +166,7 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) {
int uv_tty_set_mode(uv_tty_t* tty, int mode) {
DWORD flags = 0;
DWORD flags;
unsigned char was_reading;
uv_alloc_cb alloc_cb;
uv_read_cb read_cb;
@ -189,17 +180,12 @@ int uv_tty_set_mode(uv_tty_t* tty, int mode) {
return 0;
}
if (tty->original_console_mode & ENABLE_QUICK_EDIT_MODE) {
flags = ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS;
}
if (mode) {
/* Raw input */
flags |= ENABLE_WINDOW_INPUT;
flags = ENABLE_WINDOW_INPUT;
} else {
/* Line-buffered mode. */
flags |= ENABLE_ECHO_INPUT | ENABLE_INSERT_MODE | ENABLE_LINE_INPUT |
ENABLE_EXTENDED_FLAGS | ENABLE_PROCESSED_INPUT;
flags = ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
}
if (!SetConsoleMode(tty->handle, flags)) {
@ -822,7 +808,7 @@ int uv_tty_read_start(uv_tty_t* handle, uv_alloc_cb alloc_cb,
if (handle->last_key_len > 0) {
SET_REQ_SUCCESS(&handle->read_req);
uv_insert_pending_req(handle->loop, (uv_req_t*) &handle->read_req);
return -1;
return 0;
}
uv_tty_queue_read(loop, handle);
@ -986,7 +972,7 @@ static int uv_tty_move_caret(uv_tty_t* handle, int x, unsigned char x_relative,
static int uv_tty_reset(uv_tty_t* handle, DWORD* error) {
const COORD origin = {0, 0};
const WORD char_attrs = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_RED;
const WORD char_attrs = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
CONSOLE_SCREEN_BUFFER_INFO info;
DWORD count, written;

Loading…
Cancel
Save