Skip to content

Commit

Permalink
another approach
Browse files Browse the repository at this point in the history
  • Loading branch information
unxed committed Dec 23, 2024
1 parent 3ecf059 commit 203582d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions WinPort/src/Backend/TTY/TTYBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ static TTYBackend * g_vtb = nullptr;

long _iterm2_cmd_ts = 0;
bool _iterm2_cmd_state = 0;
DWORD vkc_prev = 0;

static void OnSigHup(int signo);

Expand Down
2 changes: 2 additions & 0 deletions WinPort/src/Backend/TTY/TTYInputSequenceParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,12 +478,14 @@ size_t TTYInputSequenceParser::Parse(const char *s, size_t l, bool idle_expired)
//work-around for double encoded events in win32-input mode
//we encountered sequence \x1B[0;0;27;1;0;1_ it is \x1B encoded in win32 input
//following codes are part of some double encoded input sequence and must be parsed in separate buffer
/*
if (
(l > 8 && s[1] == '[' && s[2] == '0' && s[3] == ';' && s[4] == '0' && s[5] == ';' && s[6] == '2' && s[7] == '7')
|| _win32_accumulate) {
_win32_accumulate = true;
return TryUnwrappWinDoubleEscapeSequence(s, l);
}
*/

size_t r = ParseIntoPending(s, l);

Expand Down
1 change: 1 addition & 0 deletions WinPort/src/Backend/TTY/TTYInputSequenceParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

extern long _iterm2_cmd_ts;
extern bool _iterm2_cmd_state;
extern DWORD vkc_prev;

struct TTYInputKey
{
Expand Down
8 changes: 8 additions & 0 deletions WinPort/src/Backend/TTY/TTYInputSequenceParserExts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,14 @@ size_t TTYInputSequenceParser::TryParseAsWinTermEscapeSequence(const char *s, si
}
}

// lens problem
if (args[3] && args[0]) { // keydown
vkc_prev = args[0];
} else if (args[0] && vkc_prev && (vkc_prev != (DWORD)args[0])) {
args[3] = 1;
vkc_prev = 0;
}

INPUT_RECORD ir = {};
ir.EventType = KEY_EVENT;
ir.Event.KeyEvent.wVirtualKeyCode = args[0] ? args[0] : VK_UNASSIGNED;
Expand Down

0 comments on commit 203582d

Please sign in to comment.