Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ctrl+Backspace support #3935

Merged
7 commits merged into from
Jan 13, 2020
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
6 changes: 4 additions & 2 deletions src/terminal/parser/InputStateMachineEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ bool InputStateMachineEngine::_DoControlCharacter(const wchar_t wch, const bool
{
// This is a C0 Control Character.
// This should be translated as Ctrl+(wch+x40)
const wchar_t actualChar = wch;
wchar_t actualChar = wch;
bool writeCtrl = true;

short vkey = 0;
Expand All @@ -213,7 +213,9 @@ bool InputStateMachineEngine::_DoControlCharacter(const wchar_t wch, const bool
switch (wch)
{
case L'\b':
success = _GenerateKeyFromChar(wch + 0x40, vkey, modifierState);
// Process Ctrl+Bksp to delete whole words
actualChar = '\x7f';
success = _GenerateKeyFromChar(actualChar, vkey, modifierState);
modifierState = 0;
break;
case L'\r':
Expand Down
4 changes: 4 additions & 0 deletions src/terminal/parser/ut_parser/InputEngineTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ void InputEngineTest::C0Test()
case L'\t': // Tab
writeCtrl = false;
break;
case L'\b': // backspace
wch = '\x7f';
expectedWch = '\x7f';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this should probably have a break too, even though it's the last case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, the latest commit added the break statement

break;
}

short keyscan = VkKeyScanW(expectedWch);
Expand Down