| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "linux.h" | ||
| 2 | #include "parse.h" | ||
| 3 | #include "util/xstring.h" | ||
| 4 | |||
| 5 | 10 | ssize_t linux_parse_key(const char *buf, size_t length, KeyCode *k) | |
| 6 | { | ||
| 7 |
4/4✓ Branch 2 → 3 taken 8 times.
✓ Branch 2 → 5 taken 2 times.
✓ Branch 4 → 5 taken 1 time.
✓ Branch 4 → 6 taken 7 times.
|
10 | if (length < 3 || !mem_equal(buf, "\033[[", 3)) { |
| 8 | 3 | return term_parse_sequence(buf, length, k); | |
| 9 | } | ||
| 10 | |||
| 11 |
2/2✓ Branch 6 → 7 taken 6 times.
✓ Branch 6 → 9 taken 1 time.
|
7 | if (unlikely(length == 3)) { |
| 12 | return TPARSE_PARTIAL_MATCH; | ||
| 13 | } | ||
| 14 | |||
| 15 | // Letters A-E represent keys F1-F5 | ||
| 16 | 6 | char c = buf[3]; | |
| 17 |
2/2✓ Branch 7 → 8 taken 5 times.
✓ Branch 7 → 9 taken 1 time.
|
6 | if (c >= 'A' && c <= 'E') { |
| 18 | 5 | *k = KEY_F1 + (c - 'A'); | |
| 19 | 5 | return 4; | |
| 20 | } | ||
| 21 | |||
| 22 | return 0; | ||
| 23 | } | ||
| 24 |