Skip to content
Open
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
19 changes: 17 additions & 2 deletions source/dcell/parser.d
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
module dcell.parser;

import core.time;
import std.algorithm : max;
import std.algorithm : max, min;
import std.ascii;
import std.base64;
import std.conv : to;
Expand Down Expand Up @@ -1001,6 +1001,21 @@ private:
evs ~= newMouseEvent(x, y, button, mod);
}

/***
* Handles Win32 input mode key sequences (CSI ... _).
*
* Parses a Win32 console input key event encoded as a CSI sequence with
* six semicolon-separated parameters, and translates it into one or more
* key events appended to `evs`.
*
* Params:
* p0 = wVirtualKeyCode (default 0)
* p1 = wVirtualScanCode (default 0)
* p2 = UnicodeChar as a decimal value (default 0)
* p3 = bKeyDown — 1 for key-down, 0 for key-up (default 0)
* p4 = dwControlKeyState — modifier flags (default 0)
* p5 = wRepeatCount — clamped to [1, 1024] to prevent CPU hang (default 1)
*/
void handleWinKey(int p0, int p1, int p2, int p3, int p4, int p5) @safe
{
// win32-input-mode
Expand Down Expand Up @@ -1046,7 +1061,7 @@ private:
auto key = Key.graph;
auto chr = p2;
auto mod = Modifiers.none;
auto rpt = max(1, p5);
auto rpt = min(max(1, p5), 1024);

if (p0 in winKeys)
{
Expand Down