mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-05 15:14:35 +08:00
Fix parsing of keys that are prefix of others. (#58)
The ESC key generates sequences that are prefix of others. For instance: - ESC => [27] - F1 => [27, 79, 8] As a result, we can't generate the ESC event when receiving [27], because it might be the start of the [27, 79, 8] sequence (or not). Application usually applies a timeout to help detecting the ESC key. This patch introduce a timeout. It is set to 50ms. Bug: https://github.com/ArthurSonzogni/FTXUI/issues/55
This commit is contained in:
@@ -21,7 +21,7 @@ std::vector<std::vector<ColorInfo>> ColorInfoSorted2D() {
|
||||
// Make 8 colums, one gray and seven colored.
|
||||
std::vector<std::vector<ColorInfo>> info_columns(8);
|
||||
info_columns[0] = info_gray;
|
||||
for (int i = 0; i < info_color.size(); ++i) {
|
||||
for (size_t i = 0; i < info_color.size(); ++i) {
|
||||
info_columns[1 + 7 * i / info_color.size()].push_back(info_color[i]);
|
||||
}
|
||||
|
||||
@@ -31,10 +31,10 @@ std::vector<std::vector<ColorInfo>> ColorInfoSorted2D() {
|
||||
[](const ColorInfo& A, const ColorInfo& B) {
|
||||
return A.value < B.value;
|
||||
});
|
||||
for (int i = 0; i < column.size() - 1; ++i) {
|
||||
for (size_t i = 0; i < column.size() - 1; ++i) {
|
||||
int best_index = i + 1;
|
||||
int best_distance = 255 * 255 * 3;
|
||||
for (int j = i + 1; j < column.size(); ++j) {
|
||||
for (size_t j = i + 1; j < column.size(); ++j) {
|
||||
int dx = column[i].red - column[j].red;
|
||||
int dy = column[i].green - column[j].green;
|
||||
int dz = column[i].blue - column[j].blue;
|
||||
|
Reference in New Issue
Block a user