diff --git a/README.md b/README.md index b2f4162..54dd1ce 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,8 @@ project into D. At present, this works reasonably well for most TTY type devices (think xterm, Terminal, Term2, etc) on Posix (Linux, macOS, etc) -systems. - -Windows support is missing. +systems. Windows Terminal and other console emulators on Windows +are also supported. It supports most of the things that Tcell supports. The API is subject to change, as I'm working on improving this. diff --git a/demos/mouse/source/mouse.d b/demos/mouse/source/mouse.d index 2fe6a3b..5b933fd 100644 --- a/demos/mouse/source/mouse.d +++ b/demos/mouse/source/mouse.d @@ -76,9 +76,9 @@ void drawSelect(Screen s, Coord c1, Coord c2, bool sel) { order(c1, c2); Coord pos; - for (pos.y = c1.y; pos.y < c2.y; pos.y++) + for (pos.y = c1.y; pos.y <= c2.y; pos.y++) { - for (pos.x = c1.x; pos.x < c2.x; pos.x++) + for (pos.x = c1.x; pos.x <= c2.x; pos.x++) { if (sel) s[pos].style.attr |= Attr.reverse; diff --git a/source/dcell/termio.d b/source/dcell/termio.d index 94b1b41..077cbe9 100644 --- a/source/dcell/termio.d +++ b/source/dcell/termio.d @@ -419,7 +419,7 @@ version (Posix) unistd.write(sigWfd, buf.ptr, 1); } - // We don't have a stanrdard definition of SIGWINCH + // We don't have a standard definition of SIGWINCH version (linux) { // Legacy Linux is not even self-compatible ick. @@ -619,8 +619,11 @@ version (Windows) switch (ev.EventType) { case KEY_EVENT: - auto chr = ev.KeyEvent.AsciiChar; - result ~= chr; + if (ev.KeyEvent.bKeyDown && ev.KeyEvent.AsciiChar != 0) + { + auto chr = ev.KeyEvent.AsciiChar; + result ~= chr; + } break; case WINDOW_BUFFER_SIZE_EVENT: wasResized = true; @@ -651,8 +654,10 @@ version (Windows) Coord windowSize() { - GetConsoleScreenBufferInfo(output, &oscreen); - return Coord(oscreen.dwSize.X, oscreen.dwSize.Y); + CONSOLE_SCREEN_BUFFER_INFO info; + GetConsoleScreenBufferInfo(output, &info); + return Coord(info.srWindow.Right - info.srWindow.Left + 1, + info.srWindow.Bottom - info.srWindow.Top + 1); } bool resized() @@ -668,7 +673,6 @@ version (Windows) HANDLE eventH; DWORD omode; DWORD imode; - CONSOLE_SCREEN_BUFFER_INFO oscreen; bool started; bool wasResized; } diff --git a/source/dcell/ttyscreen.d b/source/dcell/ttyscreen.d index fb13c7b..2d66ada 100644 --- a/source/dcell/ttyscreen.d +++ b/source/dcell/ttyscreen.d @@ -190,21 +190,12 @@ class TtyScreen : Screen { // If we don't have a $TERM (e.g. Windows Terminal), or we are dealing with WezTerm // (which cannot mix modes), then only support win32-input-mode. - if (term == "" || environment.get("TERM_PROGRAM") == "WezTerm") + if (term == "") { vt.enableCsiU = "\x1b[?9001h"; vt.disableCsiU = "\x1b[?9001l"; } } - else - { - // WezTerm is unhappy if we ask for other modes - if (environment.get("TERM_PROGRAM") == "WezTerm") - { - vt.enableCsiU = "\x1b[>1u"; - vt.disableCsiU = "\x1b[