Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions demos/mouse/source/mouse.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 10 additions & 6 deletions source/dcell/termio.d
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand All @@ -668,7 +673,6 @@ version (Windows)
HANDLE eventH;
DWORD omode;
DWORD imode;
CONSOLE_SCREEN_BUFFER_INFO oscreen;
bool started;
bool wasResized;
}
Expand Down
13 changes: 2 additions & 11 deletions source/dcell/ttyscreen.d
Original file line number Diff line number Diff line change
Expand Up @@ -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[<u";
}
}

if (legacy)
{
Expand Down Expand Up @@ -581,7 +572,7 @@ private:
{
if (pos != pos_)
{
puts(format!(Vt.setCursorPosition)(pos.y, pos.x));
puts(format!(Vt.setCursorPosition)(pos.y + 1, pos.x + 1));
pos_ = pos;
}
}
Expand Down