mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-12-16 01:48:56 +08:00
Enable raw keyboard input (#832)
In order for applications to receive all keyboard inputs, including the Ctrl-C and Ctrl-Z, the raw input mode has been enabled. As result the SIGINT will no longer be used, instead the keyboard Ctrl-C event is used for exiting the framework, but only if no components has made use of it. Co-authored-by: Jørn Gustav Larsen <jgl@fasttracksoftware.com> Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
committed by
GitHub
parent
d38b14ffb6
commit
d386df6f94
@@ -170,15 +170,8 @@ TerminalInputParser::Output TerminalInputParser::Parse() {
|
||||
return UNCOMPLETED;
|
||||
}
|
||||
|
||||
switch (Current()) {
|
||||
case 24: // CAN NOLINT
|
||||
case 26: // SUB NOLINT
|
||||
return DROP;
|
||||
|
||||
case '\x1B':
|
||||
return ParseESC();
|
||||
default:
|
||||
break;
|
||||
if (Current() == '\x1B') {
|
||||
return ParseESC();
|
||||
}
|
||||
|
||||
if (Current() < 32) { // C0 NOLINT
|
||||
@@ -282,12 +275,25 @@ TerminalInputParser::Output TerminalInputParser::ParseESC() {
|
||||
return ParseCSI();
|
||||
case ']':
|
||||
return ParseOSC();
|
||||
default:
|
||||
|
||||
// Expecting 2 characters.
|
||||
case ' ':
|
||||
case '#':
|
||||
case '%':
|
||||
case '(':
|
||||
case ')':
|
||||
case '*':
|
||||
case '+':
|
||||
case 'O':
|
||||
case 'N': {
|
||||
if (!Eat()) {
|
||||
return UNCOMPLETED;
|
||||
} else {
|
||||
return SPECIAL;
|
||||
}
|
||||
return SPECIAL;
|
||||
}
|
||||
// Expecting 1 character:
|
||||
default:
|
||||
return SPECIAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user