From 6a92e8b6096863abe0e7c676236e0e13b4a28ed3 Mon Sep 17 00:00:00 2001 From: bakpakin Date: Sat, 9 Jul 2022 11:39:06 -0500 Subject: [PATCH] Update CHANGELOG and make tweaks to win32 shell --- CHANGELOG.md | 2 ++ src/mainclient/shell.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3e3caa8..a7667604 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. ## 1.23.1 - ??? +- Add better support for windows console in the default shell.c for autocompletion and + other shell-like input features. - Improve default error message from `assert`. - Add the `tabseq` macro for simpler table comprehensions. - Allow setting `(dyn :task-id)` in fibers to improve context in supervisor messages. Prior to diff --git a/src/mainclient/shell.c b/src/mainclient/shell.c index d6140e78..28859318 100644 --- a/src/mainclient/shell.c +++ b/src/mainclient/shell.c @@ -136,6 +136,7 @@ void janet_line_get(const char *p, JanetBuffer *buffer) { #include #include #include +#include static void setup_console_output(void) { /* Enable color console on windows 10 console and utf8 output and other processing */ @@ -158,7 +159,7 @@ static int rawmode(void) { dwMode &= ~ENABLE_ECHO_INPUT; dwMode |= ENABLE_VIRTUAL_TERMINAL_INPUT; dwMode &= ~ENABLE_PROCESSED_INPUT; - SetConsoleMode(hOut, dwMode); + if (!SetConsoleMode(hOut, dwMode)) return 1; gbl_israwmode = 1; return 0; } @@ -193,7 +194,7 @@ static long read_console(char *into, size_t n) { } static int check_simpleline(JanetBuffer *buffer) { - if (rawmode()) { + if (!_isatty(_fileno(stdin)) || rawmode()) { simpleline(buffer); return 1; }