mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 23:08:31 +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
|
@ -24,18 +24,22 @@ COSMOPOLITAN_C_START_
|
|||
#define kFdTtyMunging 4 /* enable input / output remappings */
|
||||
#define kFdTtyNoCr2Nl 8 /* don't map \r → \n (a.k.a !ICRNL) */
|
||||
#define kFdTtyNoIsigs 16
|
||||
#define kFdTtyNoBlock 32
|
||||
#define kFdTtyXtMouse 64
|
||||
|
||||
struct Fd {
|
||||
char kind;
|
||||
bool eoftty;
|
||||
bool dontclose;
|
||||
char buflen;
|
||||
char buf[4];
|
||||
unsigned char buflen;
|
||||
unsigned flags;
|
||||
unsigned mode;
|
||||
int64_t handle;
|
||||
int64_t extra;
|
||||
int64_t pointer;
|
||||
pthread_mutex_t lock;
|
||||
unsigned char mousebuttons;
|
||||
char buf[32];
|
||||
};
|
||||
|
||||
struct StdinRelay {
|
||||
|
@ -55,11 +59,6 @@ struct Fds {
|
|||
struct StdinRelay stdin;
|
||||
};
|
||||
|
||||
void WinMainStdin(void);
|
||||
int64_t __resolve_stdin_handle(int64_t);
|
||||
int __munge_terminal_input(char *, uint32_t *);
|
||||
void __echo_terminal_input(struct Fd *, char *, size_t);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_FD_INTERNAL_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue