mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-12-16 01:48:56 +08:00
Update
This commit is contained in:
@@ -1022,23 +1022,23 @@ void ScreenInteractive::Signal(int signal) {
|
||||
|
||||
void ScreenInteractive::FetchTerminalEvents() {
|
||||
#if defined(_WIN32)
|
||||
auto get_input_records = [&] {
|
||||
auto get_input_records = [&] () -> std::vector<INPUT_RECORD> {
|
||||
// Check if there is input in the console.
|
||||
auto console = GetStdHandle(STD_INPUT_HANDLE);
|
||||
DWORD number_of_events = 0;
|
||||
if (!GetNumberOfConsoleInputEvents(console, &number_of_events)) {
|
||||
return;
|
||||
return std::vector<INPUT_RECORD>();
|
||||
}
|
||||
if (number_of_events <= 0) {
|
||||
// No input, return.
|
||||
return;
|
||||
return std::vector<INPUT_RECORD>();
|
||||
}
|
||||
// Read the input events.
|
||||
std::vector<INPUT_RECORD> records(number_of_events);
|
||||
DWORD number_of_events_read = 0;
|
||||
if (!ReadConsoleInput(console, records.data(), (DWORD)records.size(),
|
||||
&number_of_events_read)) {
|
||||
return;
|
||||
return std::vector<INPUT_RECORD>();
|
||||
}
|
||||
records.resize(number_of_events_read);
|
||||
return records;
|
||||
|
||||
Reference in New Issue
Block a user