mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 00:02:28 +00:00
Rewrite Windows console input handling
This change removes our use of ENABLE_VIRTUAL_TERMINAL_INPUT (which isn't very good) in favor of having read() translate Windows Console input events to ANSI/XTERM sequences by hand. This makes it possible to capture important keystrokes (e.g. ctrl-space) that weren't possible before. Most importantly this change also removes the stdin/sigwinch worker threads, which never really worked that well. Interactive TTY sessions will now work reliably when a Cosmo process spawns or forks another Cosmo process, e.g. unbourne.com launching emacs.com.
This commit is contained in:
parent
ececec4c94
commit
d6c2830850
27 changed files with 635 additions and 464 deletions
|
@ -28,8 +28,6 @@
|
|||
#include "libc/sysv/consts/termios.h"
|
||||
#include "libc/x/xsigaction.h"
|
||||
|
||||
__static_yoink("WinMainStdin");
|
||||
|
||||
#define CTRL(C) ((C) ^ 0b01000000)
|
||||
#define WRITE(FD, SLIT) write(FD, SLIT, strlen(SLIT))
|
||||
#define ENABLE_SAFE_PASTE "\e[?2004h"
|
||||
|
@ -69,7 +67,7 @@ int rawmode(void) {
|
|||
memcpy(&t, &oldterm, sizeof(t));
|
||||
|
||||
t.c_cc[VMIN] = 1;
|
||||
t.c_cc[VTIME] = 1;
|
||||
t.c_cc[VTIME] = 0;
|
||||
|
||||
// emacs does the following to remap ctrl-c to ctrl-g in termios
|
||||
// t.c_cc[VINTR] = CTRL('G');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue