|
57 | 57 |
|
58 | 58 | #define MAX_INPUT_BUFFER_LENGTH 8192
|
59 | 59 |
|
60 |
| -#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING |
61 |
| -#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 |
62 |
| -#endif |
63 | 60 |
|
64 | 61 | static void uv_tty_capture_initial_style(CONSOLE_SCREEN_BUFFER_INFO* info);
|
65 | 62 | static void uv_tty_update_virtual_window(CONSOLE_SCREEN_BUFFER_INFO* info);
|
@@ -128,14 +125,6 @@ static char uv_tty_default_fg_bright = 0;
|
128 | 125 | static char uv_tty_default_bg_bright = 0;
|
129 | 126 | static char uv_tty_default_inverse = 0;
|
130 | 127 |
|
131 |
| -typedef enum { |
132 |
| - UV_SUPPORTED, |
133 |
| - UV_UNCHECKED, |
134 |
| - UV_UNSUPPORTED |
135 |
| -} uv_vtermstate_t; |
136 |
| -/* Determine whether or not ANSI support is enabled. */ |
137 |
| -static uv_vtermstate_t uv__vterm_state = UV_UNCHECKED; |
138 |
| -static void uv__determine_vterm_state(HANDLE handle); |
139 | 128 |
|
140 | 129 | void uv_console_init() {
|
141 | 130 | if (uv_sem_init(&uv_tty_output_lock, 1))
|
@@ -179,9 +168,6 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) {
|
179 | 168 | /* shared between all uv_tty_t handles. */
|
180 | 169 | uv_sem_wait(&uv_tty_output_lock);
|
181 | 170 |
|
182 |
| - if (uv__vterm_state == UV_UNCHECKED) |
183 |
| - uv__determine_vterm_state(handle); |
184 |
| - |
185 | 171 | /* Store the global tty output handle. This handle is used by TTY read */
|
186 | 172 | /* streams to update the virtual window when a CONSOLE_BUFFER_SIZE_EVENT */
|
187 | 173 | /* is received. */
|
@@ -1650,33 +1636,6 @@ static int uv_tty_write_bufs(uv_tty_t* handle,
|
1650 | 1636 | uv_buf_t buf = bufs[i];
|
1651 | 1637 | unsigned int j;
|
1652 | 1638 |
|
1653 |
| - if (uv__vterm_state == UV_SUPPORTED) { |
1654 |
| - utf16_buf_used = MultiByteToWideChar(CP_UTF8, |
1655 |
| - 0, |
1656 |
| - buf.base, |
1657 |
| - buf.len, |
1658 |
| - NULL, |
1659 |
| - 0); |
1660 |
| - |
1661 |
| - if (utf16_buf_used == 0) { |
1662 |
| - *error = GetLastError(); |
1663 |
| - break; |
1664 |
| - } |
1665 |
| - |
1666 |
| - if (!MultiByteToWideChar(CP_UTF8, |
1667 |
| - 0, |
1668 |
| - buf.base, |
1669 |
| - buf.len, |
1670 |
| - utf16_buf, |
1671 |
| - utf16_buf_used)) { |
1672 |
| - *error = GetLastError(); |
1673 |
| - break; |
1674 |
| - } |
1675 |
| - |
1676 |
| - FLUSH_TEXT(); |
1677 |
| - continue; |
1678 |
| - } |
1679 |
| - |
1680 | 1639 | for (j = 0; j < buf.len; j++) {
|
1681 | 1640 | unsigned char c = buf.base[j];
|
1682 | 1641 |
|
@@ -2234,24 +2193,3 @@ int uv_tty_reset_mode(void) {
|
2234 | 2193 | /* Not necessary to do anything. */
|
2235 | 2194 | return 0;
|
2236 | 2195 | }
|
2237 |
| - |
2238 |
| -/* Determine whether or not this version of windows supports |
2239 |
| - * proper ANSI color codes. Should be supported as of windows |
2240 |
| - * 10 version 1511, build number 10.0.10586. |
2241 |
| - */ |
2242 |
| -static void uv__determine_vterm_state(HANDLE handle) { |
2243 |
| - DWORD dwMode = 0; |
2244 |
| - |
2245 |
| - if (!GetConsoleMode(handle, &dwMode)) { |
2246 |
| - uv__vterm_state = UV_UNSUPPORTED; |
2247 |
| - return; |
2248 |
| - } |
2249 |
| - |
2250 |
| - dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; |
2251 |
| - if (!SetConsoleMode(handle, dwMode)) { |
2252 |
| - uv__vterm_state = UV_UNSUPPORTED; |
2253 |
| - return; |
2254 |
| - } |
2255 |
| - |
2256 |
| - uv__vterm_state = UV_SUPPORTED; |
2257 |
| -} |
0 commit comments