mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-10-04 13:41:02 +00:00
Implement basic canonical mode for Windows
The `cat` command now works properly, when run by itself on the bash command prompt. It's working beautifully so far, and is only missing a few keystrokes for clearing words and lines. Definitely works more well than the one that ships with WIN32 :-)
This commit is contained in:
parent
4825737509
commit
f26a280cda
36 changed files with 320 additions and 231 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "libc/calls/internal.h"
|
||||
#include "libc/calls/syscall_support-nt.internal.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/intrin/nomultics.internal.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/log/libfatal.internal.h"
|
||||
|
@ -136,13 +137,14 @@ static abi wontreturn void WinInit(const char16_t *cmdline) {
|
|||
for (int i = 0; i <= 2; ++i) {
|
||||
uint32_t m;
|
||||
intptr_t h = __imp_GetStdHandle(kNtStdio[i]);
|
||||
__imp_GetConsoleMode(h, &m);
|
||||
if (!i) {
|
||||
m |= kNtEnableMouseInput | kNtEnableWindowInput;
|
||||
} else {
|
||||
m |= kNtEnableVirtualTerminalProcessing;
|
||||
if (__imp_GetConsoleMode(h, &m)) {
|
||||
if (!i) {
|
||||
m |= kNtEnableMouseInput | kNtEnableWindowInput;
|
||||
} else {
|
||||
m |= kNtEnableVirtualTerminalProcessing;
|
||||
}
|
||||
__imp_SetConsoleMode(h, m);
|
||||
}
|
||||
__imp_SetConsoleMode(h, m);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue