Lines Matching refs:handle
69 static int uv__cancel_read_console(uv_tty_t* handle);
159 static void uv__determine_vterm_state(HANDLE handle);
188 HANDLE handle; in uv_tty_init() local
194 handle = (HANDLE) uv__get_osfhandle(fd); in uv_tty_init()
195 if (handle == INVALID_HANDLE_VALUE) in uv_tty_init()
206 handle, in uv_tty_init()
208 &handle, in uv_tty_init()
216 readable = GetNumberOfConsoleInputEvents(handle, &NumberOfEvents); in uv_tty_init()
219 if (!GetConsoleScreenBufferInfo(handle, &screen_buffer_info)) { in uv_tty_init()
224 if (!GetConsoleCursorInfo(handle, &cursor_info)) { in uv_tty_init()
233 uv__determine_vterm_state(handle); in uv_tty_init()
247 tty->handle = handle; in uv_tty_init()
389 if (!SetConsoleMode(tty->handle, flags)) { in uv_tty_set_mode()
415 if (!GetConsoleScreenBufferInfo(tty->handle, &info)) { in uv_tty_get_winsize()
432 uv_tty_t* handle; in uv_tty_post_raw_read() local
439 handle = (uv_tty_t*) req->data; in uv_tty_post_raw_read()
440 loop = handle->loop; in uv_tty_post_raw_read()
442 UnregisterWait(handle->tty.rd.read_raw_wait); in uv_tty_post_raw_read()
443 handle->tty.rd.read_raw_wait = NULL; in uv_tty_post_raw_read()
450 static void uv__tty_queue_read_raw(uv_loop_t* loop, uv_tty_t* handle) { in uv__tty_queue_read_raw() argument
454 assert(handle->flags & UV_HANDLE_READING); in uv__tty_queue_read_raw()
455 assert(!(handle->flags & UV_HANDLE_READ_PENDING)); in uv__tty_queue_read_raw()
457 assert(handle->handle && handle->handle != INVALID_HANDLE_VALUE); in uv__tty_queue_read_raw()
459 handle->tty.rd.read_line_buffer = uv_null_buf_; in uv__tty_queue_read_raw()
461 req = &handle->read_req; in uv__tty_queue_read_raw()
464 r = RegisterWaitForSingleObject(&handle->tty.rd.read_raw_wait, in uv__tty_queue_read_raw()
465 handle->handle, in uv__tty_queue_read_raw()
471 handle->tty.rd.read_raw_wait = NULL; in uv__tty_queue_read_raw()
476 handle->flags |= UV_HANDLE_READ_PENDING; in uv__tty_queue_read_raw()
477 handle->reqs_pending++; in uv__tty_queue_read_raw()
483 uv_tty_t* handle; in uv_tty_line_read_thread() local
497 handle = (uv_tty_t*) req->data; in uv_tty_line_read_thread()
498 loop = handle->loop; in uv_tty_line_read_thread()
500 assert(handle->tty.rd.read_line_buffer.base != NULL); in uv_tty_line_read_thread()
501 assert(handle->tty.rd.read_line_buffer.len > 0); in uv_tty_line_read_thread()
504 if (handle->tty.rd.read_line_buffer.len < MAX_INPUT_BUFFER_LENGTH) { in uv_tty_line_read_thread()
505 bytes = handle->tty.rd.read_line_buffer.len; in uv_tty_line_read_thread()
523 read_console_success = ReadConsoleW(handle->handle, in uv_tty_line_read_thread()
533 &handle->tty.rd.read_line_buffer.base, in uv_tty_line_read_thread()
576 static void uv__tty_queue_read_line(uv_loop_t* loop, uv_tty_t* handle) { in uv__tty_queue_read_line() argument
580 assert(handle->flags & UV_HANDLE_READING); in uv__tty_queue_read_line()
581 assert(!(handle->flags & UV_HANDLE_READ_PENDING)); in uv__tty_queue_read_line()
582 assert(handle->handle && handle->handle != INVALID_HANDLE_VALUE); in uv__tty_queue_read_line()
584 req = &handle->read_req; in uv__tty_queue_read_line()
587 handle->tty.rd.read_line_buffer = uv_buf_init(NULL, 0); in uv__tty_queue_read_line()
588 handle->alloc_cb((uv_handle_t*) handle, 8192, &handle->tty.rd.read_line_buffer); in uv__tty_queue_read_line()
589 if (handle->tty.rd.read_line_buffer.base == NULL || in uv__tty_queue_read_line()
590 handle->tty.rd.read_line_buffer.len == 0) { in uv__tty_queue_read_line()
591 handle->read_cb((uv_stream_t*) handle, in uv__tty_queue_read_line()
593 &handle->tty.rd.read_line_buffer); in uv__tty_queue_read_line()
596 assert(handle->tty.rd.read_line_buffer.base != NULL); in uv__tty_queue_read_line()
611 handle->flags |= UV_HANDLE_READ_PENDING; in uv__tty_queue_read_line()
612 handle->reqs_pending++; in uv__tty_queue_read_line()
616 static void uv__tty_queue_read(uv_loop_t* loop, uv_tty_t* handle) { in uv__tty_queue_read() argument
617 if (handle->flags & UV_HANDLE_TTY_RAW) { in uv__tty_queue_read()
618 uv__tty_queue_read_raw(loop, handle); in uv__tty_queue_read()
620 uv__tty_queue_read_line(loop, handle); in uv__tty_queue_read()
691 void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, in uv_process_tty_read_raw_req() argument
694 #define KEV handle->tty.rd.last_input_record.Event.KeyEvent in uv_process_tty_read_raw_req()
700 assert(handle->type == UV_TTY); in uv_process_tty_read_raw_req()
701 assert(handle->flags & UV_HANDLE_TTY_READABLE); in uv_process_tty_read_raw_req()
702 handle->flags &= ~UV_HANDLE_READ_PENDING; in uv_process_tty_read_raw_req()
704 if (!(handle->flags & UV_HANDLE_READING) || in uv_process_tty_read_raw_req()
705 !(handle->flags & UV_HANDLE_TTY_RAW)) { in uv_process_tty_read_raw_req()
711 if ((handle->flags & UV_HANDLE_READING)) { in uv_process_tty_read_raw_req()
712 handle->flags &= ~UV_HANDLE_READING; in uv_process_tty_read_raw_req()
713 handle->read_cb((uv_stream_t*)handle, in uv_process_tty_read_raw_req()
721 if (!GetNumberOfConsoleInputEvents(handle->handle, &records_left)) { in uv_process_tty_read_raw_req()
722 handle->flags &= ~UV_HANDLE_READING; in uv_process_tty_read_raw_req()
723 DECREASE_ACTIVE_COUNT(loop, handle); in uv_process_tty_read_raw_req()
724 handle->read_cb((uv_stream_t*)handle, in uv_process_tty_read_raw_req()
735 while ((records_left > 0 || handle->tty.rd.last_key_len > 0) && in uv_process_tty_read_raw_req()
736 (handle->flags & UV_HANDLE_READING)) { in uv_process_tty_read_raw_req()
737 if (handle->tty.rd.last_key_len == 0) { in uv_process_tty_read_raw_req()
739 if (!ReadConsoleInputW(handle->handle, in uv_process_tty_read_raw_req()
740 &handle->tty.rd.last_input_record, in uv_process_tty_read_raw_req()
743 handle->flags &= ~UV_HANDLE_READING; in uv_process_tty_read_raw_req()
744 DECREASE_ACTIVE_COUNT(loop, handle); in uv_process_tty_read_raw_req()
745 handle->read_cb((uv_stream_t*) handle, in uv_process_tty_read_raw_req()
754 if (handle->tty.rd.last_input_record.EventType == WINDOW_BUFFER_SIZE_EVENT) { in uv_process_tty_read_raw_req()
759 if (handle->tty.rd.last_input_record.EventType != KEY_EVENT) { in uv_process_tty_read_raw_req()
808 handle->tty.rd.last_utf16_high_surrogate = KEV.uChar.UnicodeChar; in uv_process_tty_read_raw_req()
817 handle->tty.rd.last_key[0] = '\033'; in uv_process_tty_read_raw_req()
823 char_len = sizeof handle->tty.rd.last_key; in uv_process_tty_read_raw_req()
824 last_key_buf = &handle->tty.rd.last_key[prefix_len]; in uv_process_tty_read_raw_req()
825 if (handle->tty.rd.last_utf16_high_surrogate) { in uv_process_tty_read_raw_req()
828 utf16_buffer[0] = handle->tty.rd.last_utf16_high_surrogate; in uv_process_tty_read_raw_req()
835 handle->tty.rd.last_utf16_high_surrogate = 0; in uv_process_tty_read_raw_req()
848 handle->flags &= ~UV_HANDLE_READING; in uv_process_tty_read_raw_req()
849 DECREASE_ACTIVE_COUNT(loop, handle); in uv_process_tty_read_raw_req()
850 handle->read_cb((uv_stream_t*) handle, in uv_process_tty_read_raw_req()
856 handle->tty.rd.last_key_len = (unsigned char) (prefix_len + char_len); in uv_process_tty_read_raw_req()
857 handle->tty.rd.last_key_offset = 0; in uv_process_tty_read_raw_req()
879 handle->tty.rd.last_key[0] = '\033'; in uv_process_tty_read_raw_req()
886 assert(prefix_len + vt100_len < sizeof handle->tty.rd.last_key); in uv_process_tty_read_raw_req()
887 memcpy(&handle->tty.rd.last_key[prefix_len], vt100, vt100_len); in uv_process_tty_read_raw_req()
889 handle->tty.rd.last_key_len = (unsigned char) (prefix_len + vt100_len); in uv_process_tty_read_raw_req()
890 handle->tty.rd.last_key_offset = 0; in uv_process_tty_read_raw_req()
895 if (handle->tty.rd.last_key_offset < handle->tty.rd.last_key_len) { in uv_process_tty_read_raw_req()
899 handle->alloc_cb((uv_handle_t*) handle, 1024, &buf); in uv_process_tty_read_raw_req()
901 handle->read_cb((uv_stream_t*) handle, UV_ENOBUFS, &buf); in uv_process_tty_read_raw_req()
907 buf.base[buf_used++] = handle->tty.rd.last_key[handle->tty.rd.last_key_offset++]; in uv_process_tty_read_raw_req()
911 handle->read_cb((uv_stream_t*) handle, buf_used, &buf); in uv_process_tty_read_raw_req()
921 handle->tty.rd.last_key_offset = 0; in uv_process_tty_read_raw_req()
925 handle->tty.rd.last_key_len = 0; in uv_process_tty_read_raw_req()
932 handle->read_cb((uv_stream_t*) handle, buf_used, &buf); in uv_process_tty_read_raw_req()
937 if ((handle->flags & UV_HANDLE_READING) && in uv_process_tty_read_raw_req()
938 !(handle->flags & UV_HANDLE_READ_PENDING)) { in uv_process_tty_read_raw_req()
939 uv__tty_queue_read(loop, handle); in uv_process_tty_read_raw_req()
942 DECREASE_PENDING_REQ_COUNT(handle); in uv_process_tty_read_raw_req()
949 void uv_process_tty_read_line_req(uv_loop_t* loop, uv_tty_t* handle, in uv_process_tty_read_line_req() argument
953 assert(handle->type == UV_TTY); in uv_process_tty_read_line_req()
954 assert(handle->flags & UV_HANDLE_TTY_READABLE); in uv_process_tty_read_line_req()
956 buf = handle->tty.rd.read_line_buffer; in uv_process_tty_read_line_req()
958 handle->flags &= ~UV_HANDLE_READ_PENDING; in uv_process_tty_read_line_req()
959 handle->tty.rd.read_line_buffer = uv_null_buf_; in uv_process_tty_read_line_req()
963 if (handle->flags & UV_HANDLE_READING) { in uv_process_tty_read_line_req()
965 handle->flags &= ~UV_HANDLE_READING; in uv_process_tty_read_line_req()
966 DECREASE_ACTIVE_COUNT(loop, handle); in uv_process_tty_read_line_req()
967 handle->read_cb((uv_stream_t*) handle, in uv_process_tty_read_line_req()
972 if (!(handle->flags & UV_HANDLE_CANCELLATION_PENDING) && in uv_process_tty_read_line_req()
976 handle->read_cb((uv_stream_t*) handle, bytes, &buf); in uv_process_tty_read_line_req()
978 handle->flags &= ~UV_HANDLE_CANCELLATION_PENDING; in uv_process_tty_read_line_req()
982 if ((handle->flags & UV_HANDLE_READING) && in uv_process_tty_read_line_req()
983 !(handle->flags & UV_HANDLE_READ_PENDING)) { in uv_process_tty_read_line_req()
984 uv__tty_queue_read(loop, handle); in uv_process_tty_read_line_req()
987 DECREASE_PENDING_REQ_COUNT(handle); in uv_process_tty_read_line_req()
991 void uv__process_tty_read_req(uv_loop_t* loop, uv_tty_t* handle, in uv__process_tty_read_req() argument
993 assert(handle->type == UV_TTY); in uv__process_tty_read_req()
994 assert(handle->flags & UV_HANDLE_TTY_READABLE); in uv__process_tty_read_req()
999 if (handle->tty.rd.read_line_buffer.len == 0) { in uv__process_tty_read_req()
1000 uv_process_tty_read_raw_req(loop, handle, req); in uv__process_tty_read_req()
1002 uv_process_tty_read_line_req(loop, handle, req); in uv__process_tty_read_req()
1007 int uv__tty_read_start(uv_tty_t* handle, uv_alloc_cb alloc_cb, in uv__tty_read_start() argument
1009 uv_loop_t* loop = handle->loop; in uv__tty_read_start()
1011 if (!(handle->flags & UV_HANDLE_TTY_READABLE)) { in uv__tty_read_start()
1015 handle->flags |= UV_HANDLE_READING; in uv__tty_read_start()
1016 INCREASE_ACTIVE_COUNT(loop, handle); in uv__tty_read_start()
1017 handle->read_cb = read_cb; in uv__tty_read_start()
1018 handle->alloc_cb = alloc_cb; in uv__tty_read_start()
1022 if (handle->flags & UV_HANDLE_READ_PENDING) { in uv__tty_read_start()
1028 if (handle->tty.rd.last_key_len > 0) { in uv__tty_read_start()
1029 SET_REQ_SUCCESS(&handle->read_req); in uv__tty_read_start()
1030 uv__insert_pending_req(handle->loop, (uv_req_t*) &handle->read_req); in uv__tty_read_start()
1032 handle->flags |= UV_HANDLE_READ_PENDING; in uv__tty_read_start()
1033 handle->reqs_pending++; in uv__tty_read_start()
1037 uv__tty_queue_read(loop, handle); in uv__tty_read_start()
1043 int uv__tty_read_stop(uv_tty_t* handle) { in uv__tty_read_stop() argument
1047 handle->flags &= ~UV_HANDLE_READING; in uv__tty_read_stop()
1048 DECREASE_ACTIVE_COUNT(handle->loop, handle); in uv__tty_read_stop()
1050 if (!(handle->flags & UV_HANDLE_READ_PENDING)) in uv__tty_read_stop()
1053 if (handle->flags & UV_HANDLE_TTY_RAW) { in uv__tty_read_stop()
1058 if (!WriteConsoleInputW(handle->handle, &record, 1, &written)) { in uv__tty_read_stop()
1061 } else if (!(handle->flags & UV_HANDLE_CANCELLATION_PENDING)) { in uv__tty_read_stop()
1063 err = uv__cancel_read_console(handle); in uv__tty_read_stop()
1067 handle->flags |= UV_HANDLE_CANCELLATION_PENDING; in uv__tty_read_stop()
1073 static int uv__cancel_read_console(uv_tty_t* handle) { in uv__cancel_read_console() argument
1080 assert(!(handle->flags & UV_HANDLE_CANCELLATION_PENDING)); in uv__cancel_read_console()
1119 if (!WriteConsoleInputW(handle->handle, &record, 1, &written)) in uv__cancel_read_console()
1152 static COORD uv__tty_make_real_coord(uv_tty_t* handle, in uv__tty_make_real_coord() argument
1189 static int uv__tty_emit_text(uv_tty_t* handle, WCHAR buffer[], DWORD length, in uv__tty_emit_text() argument
1197 if (!WriteConsoleW(handle->handle, in uv__tty_emit_text()
1210 static int uv__tty_move_caret(uv_tty_t* handle, int x, unsigned char x_relative, in uv__tty_move_caret() argument
1220 if (!GetConsoleScreenBufferInfo(handle->handle, &info)) { in uv__tty_move_caret()
1224 pos = uv__tty_make_real_coord(handle, &info, x, x_relative, y, y_relative); in uv__tty_move_caret()
1226 if (!SetConsoleCursorPosition(handle->handle, pos)) { in uv__tty_move_caret()
1240 static int uv__tty_reset(uv_tty_t* handle, DWORD* error) { in uv__tty_reset() argument
1251 if (!SetConsoleTextAttribute(handle->handle, char_attrs)) { in uv__tty_reset()
1257 if (!SetConsoleCursorPosition(handle->handle, origin)) { in uv__tty_reset()
1264 if (!GetConsoleScreenBufferInfo(handle->handle, &screen_buffer_info)) { in uv__tty_reset()
1271 if (!(FillConsoleOutputCharacterW(handle->handle, in uv__tty_reset()
1276 FillConsoleOutputAttribute(handle->handle, in uv__tty_reset()
1295 if (!SetConsoleCursorInfo(handle->handle, &uv_tty_default_cursor_info)) { in uv__tty_reset()
1304 static int uv__tty_clear(uv_tty_t* handle, int dir, char entire_screen, in uv__tty_clear() argument
1351 if (!GetConsoleScreenBufferInfo(handle->handle, &info)) { in uv__tty_clear()
1356 start = uv__tty_make_real_coord(handle, &info, x1, x1r, y1, y1r); in uv__tty_clear()
1357 end = uv__tty_make_real_coord(handle, &info, x2, x2r, y2, y2r); in uv__tty_clear()
1361 if (!(FillConsoleOutputCharacterW(handle->handle, in uv__tty_clear()
1366 FillConsoleOutputAttribute(handle->handle, in uv__tty_clear()
1392 static int uv__tty_set_style(uv_tty_t* handle, DWORD* error) { in uv__tty_set_style() argument
1393 unsigned short argc = handle->tty.wr.ansi_csi_argc; in uv__tty_set_style()
1394 unsigned short* argv = handle->tty.wr.ansi_csi_argv; in uv__tty_set_style()
1488 if (!GetConsoleScreenBufferInfo(handle->handle, &info)) { in uv__tty_set_style()
1539 if (!SetConsoleTextAttribute(handle->handle, info.wAttributes)) { in uv__tty_set_style()
1548 static int uv__tty_save_state(uv_tty_t* handle, unsigned char save_attributes, in uv__tty_save_state() argument
1556 if (!GetConsoleScreenBufferInfo(handle->handle, &info)) { in uv__tty_save_state()
1563 handle->tty.wr.saved_position.X = info.dwCursorPosition.X; in uv__tty_save_state()
1564 handle->tty.wr.saved_position.Y = info.dwCursorPosition.Y - in uv__tty_save_state()
1566 handle->flags |= UV_HANDLE_TTY_SAVED_POSITION; in uv__tty_save_state()
1569 handle->tty.wr.saved_attributes = info.wAttributes & in uv__tty_save_state()
1571 handle->flags |= UV_HANDLE_TTY_SAVED_ATTRIBUTES; in uv__tty_save_state()
1578 static int uv__tty_restore_state(uv_tty_t* handle, in uv__tty_restore_state() argument
1587 if (handle->flags & UV_HANDLE_TTY_SAVED_POSITION) { in uv__tty_restore_state()
1588 if (uv__tty_move_caret(handle, in uv__tty_restore_state()
1589 handle->tty.wr.saved_position.X, in uv__tty_restore_state()
1591 handle->tty.wr.saved_position.Y, in uv__tty_restore_state()
1599 (handle->flags & UV_HANDLE_TTY_SAVED_ATTRIBUTES)) { in uv__tty_restore_state()
1600 if (!GetConsoleScreenBufferInfo(handle->handle, &info)) { in uv__tty_restore_state()
1607 new_attributes |= handle->tty.wr.saved_attributes; in uv__tty_restore_state()
1609 if (!SetConsoleTextAttribute(handle->handle, new_attributes)) { in uv__tty_restore_state()
1618 static int uv__tty_set_cursor_visibility(uv_tty_t* handle, in uv__tty_set_cursor_visibility() argument
1623 if (!GetConsoleCursorInfo(handle->handle, &cursor_info)) { in uv__tty_set_cursor_visibility()
1630 if (!SetConsoleCursorInfo(handle->handle, &cursor_info)) { in uv__tty_set_cursor_visibility()
1638 static int uv__tty_set_cursor_shape(uv_tty_t* handle, int style, DWORD* error) { in uv__tty_set_cursor_shape() argument
1641 if (!GetConsoleCursorInfo(handle->handle, &cursor_info)) { in uv__tty_set_cursor_shape()
1654 if (!SetConsoleCursorInfo(handle->handle, &cursor_info)) { in uv__tty_set_cursor_shape()
1663 static int uv__tty_write_bufs(uv_tty_t* handle, argument
1676 uv__tty_emit_text(handle, utf16_buf, utf16_buf_used, error); \
1687 unsigned char utf8_bytes_left = handle->tty.wr.utf8_bytes_left;
1688 unsigned int utf8_codepoint = handle->tty.wr.utf8_codepoint;
1689 unsigned char previous_eol = handle->tty.wr.previous_eol;
1690 unsigned short ansi_parser_state = handle->tty.wr.ansi_parser_state;
1768 handle->tty.wr.ansi_csi_argc = 0;
1776 handle->tty.wr.ansi_csi_argc = 0;
1795 uv__tty_reset(handle, error);
1802 uv__tty_save_state(handle, 1, error);
1809 uv__tty_restore_state(handle, 1, error);
1838 int style = handle->tty.wr.ansi_csi_argc
1839 ? handle->tty.wr.ansi_csi_argv[0] : 1;
1842 uv__tty_set_cursor_shape(handle, style, error);
1863 if (handle->tty.wr.ansi_csi_argc >=
1864 ARRAY_SIZE(handle->tty.wr.ansi_csi_argv)) {
1869 handle->tty.wr.ansi_csi_argc++;
1870 handle->tty.wr.ansi_csi_argv[handle->tty.wr.ansi_csi_argc - 1] =
1877 handle->tty.wr.ansi_csi_argv[handle->tty.wr.ansi_csi_argc - 1];
1885 handle->tty.wr.ansi_csi_argv[handle->tty.wr.ansi_csi_argc - 1] =
1901 if (handle->tty.wr.ansi_csi_argc >=
1903 ARRAY_SIZE(handle->tty.wr.ansi_csi_argv)) {
1908 handle->tty.wr.ansi_csi_argc++;
1909 handle->tty.wr.ansi_csi_argv[handle->tty.wr.ansi_csi_argc - 1] = 0;
1916 handle->tty.wr.ansi_csi_argc == 0) {
1937 if (handle->tty.wr.ansi_csi_argc == 1 &&
1938 handle->tty.wr.ansi_csi_argv[0] == 25) {
1940 uv__tty_set_cursor_visibility(handle, 0, error);
1946 if (handle->tty.wr.ansi_csi_argc == 1 &&
1947 handle->tty.wr.ansi_csi_argv[0] == 25) {
1949 uv__tty_set_cursor_visibility(handle, 1, error);
1961 y = -(handle->tty.wr.ansi_csi_argc
1962 ? handle->tty.wr.ansi_csi_argv[0] : 1);
1963 uv__tty_move_caret(handle, 0, 1, y, 1, error);
1969 y = handle->tty.wr.ansi_csi_argc
1970 ? handle->tty.wr.ansi_csi_argv[0] : 1;
1971 uv__tty_move_caret(handle, 0, 1, y, 1, error);
1977 x = handle->tty.wr.ansi_csi_argc
1978 ? handle->tty.wr.ansi_csi_argv[0] : 1;
1979 uv__tty_move_caret(handle, x, 1, 0, 1, error);
1985 x = -(handle->tty.wr.ansi_csi_argc
1986 ? handle->tty.wr.ansi_csi_argv[0] : 1);
1987 uv__tty_move_caret(handle, x, 1, 0, 1, error);
1993 y = handle->tty.wr.ansi_csi_argc
1994 ? handle->tty.wr.ansi_csi_argv[0] : 1;
1995 uv__tty_move_caret(handle, 0, 0, y, 1, error);
2001 y = -(handle->tty.wr.ansi_csi_argc
2002 ? handle->tty.wr.ansi_csi_argv[0] : 1);
2003 uv__tty_move_caret(handle, 0, 0, y, 1, error);
2009 x = (handle->tty.wr.ansi_csi_argc >= 1 &&
2010 handle->tty.wr.ansi_csi_argv[0])
2011 ? handle->tty.wr.ansi_csi_argv[0] - 1 : 0;
2012 uv__tty_move_caret(handle, x, 0, 0, 1, error);
2019 y = (handle->tty.wr.ansi_csi_argc >= 1 &&
2020 handle->tty.wr.ansi_csi_argv[0])
2021 ? handle->tty.wr.ansi_csi_argv[0] - 1 : 0;
2022 x = (handle->tty.wr.ansi_csi_argc >= 2 &&
2023 handle->tty.wr.ansi_csi_argv[1])
2024 ? handle->tty.wr.ansi_csi_argv[1] - 1 : 0;
2025 uv__tty_move_caret(handle, x, 0, y, 0, error);
2031 d = handle->tty.wr.ansi_csi_argc
2032 ? handle->tty.wr.ansi_csi_argv[0] : 0;
2034 uv__tty_clear(handle, d, 1, error);
2041 d = handle->tty.wr.ansi_csi_argc
2042 ? handle->tty.wr.ansi_csi_argv[0] : 0;
2044 uv__tty_clear(handle, d, 0, error);
2051 uv__tty_set_style(handle, error);
2057 uv__tty_save_state(handle, 0, error);
2063 uv__tty_restore_state(handle, 0, error);
2155 handle->tty.wr.utf8_bytes_left = utf8_bytes_left;
2156 handle->tty.wr.utf8_codepoint = utf8_codepoint;
2157 handle->tty.wr.previous_eol = previous_eol;
2158 handle->tty.wr.ansi_parser_state = ansi_parser_state;
2174 uv_tty_t* handle, argument
2181 req->handle = (uv_stream_t*) handle;
2184 handle->reqs_pending++;
2185 handle->stream.conn.write_reqs_pending++;
2186 REGISTER_HANDLE_REQ(loop, handle);
2190 if (!uv__tty_write_bufs(handle, bufs, nbufs, &error)) {
2202 int uv__tty_try_write(uv_tty_t* handle, argument
2207 if (handle->stream.conn.write_reqs_pending > 0)
2210 if (uv__tty_write_bufs(handle, bufs, nbufs, &error))
2217 void uv__process_tty_write_req(uv_loop_t* loop, uv_tty_t* handle, argument
2221 handle->write_queue_size -= req->u.io.queued_bytes;
2222 UNREGISTER_HANDLE_REQ(loop, handle);
2230 handle->stream.conn.write_reqs_pending--;
2231 if (handle->stream.conn.write_reqs_pending == 0 &&
2232 uv__is_stream_shutting(handle))
2234 handle,
2235 handle->stream.conn.shutdown_req);
2237 DECREASE_PENDING_REQ_COUNT(handle);
2241 void uv__tty_close(uv_tty_t* handle) { argument
2242 assert(handle->u.fd == -1 || handle->u.fd > 2);
2243 if (handle->flags & UV_HANDLE_READING)
2244 uv__tty_read_stop(handle);
2246 if (handle->u.fd == -1)
2247 CloseHandle(handle->handle);
2249 _close(handle->u.fd);
2251 handle->u.fd = -1;
2252 handle->handle = INVALID_HANDLE_VALUE;
2253 handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE);
2254 uv__handle_closing(handle);
2256 if (handle->reqs_pending == 0)
2257 uv__want_endgame(handle->loop, (uv_handle_t*) handle);
2281 void uv__tty_endgame(uv_loop_t* loop, uv_tty_t* handle) { argument
2282 assert(handle->flags & UV_HANDLE_CLOSING);
2283 assert(handle->reqs_pending == 0);
2287 assert(!(handle->flags & UV_HANDLE_TTY_READABLE) ||
2288 handle->tty.rd.read_raw_wait == NULL);
2290 assert(!(handle->flags & UV_HANDLE_CLOSED));
2291 uv__handle_close(handle);
2304 static void uv__determine_vterm_state(HANDLE handle) { argument
2308 if (!GetConsoleMode(handle, &dwMode)) {
2313 if (!SetConsoleMode(handle, dwMode)) {