Improve investigation capabilities

This commit is contained in:
Přemysl Eric Janouch 2020-09-12 13:53:27 +02:00
parent 3fcb2896cb
commit 0c33532611
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 9 additions and 2 deletions

View File

@ -130,8 +130,14 @@ static void test_mouse(int mode) {
if (sscanf(resp, CSI "M%c%c%c", &bc, &xc, &yc) == 3 if (sscanf(resp, CSI "M%c%c%c", &bc, &xc, &yc) == 3
&& bc >= 32 && xc >= 32 && yc >= 32) { && bc >= 32 && xc >= 32 && yc >= 32) {
// Beware that this isn't compatible with xterm run with the -lc switch. // Beware that this isn't compatible with xterm run with the -lc switch.
if (strlen(resp) > 6) printf("1005\n"); if (strlen(resp) > 6) {
else printf("1000/1005 (%d @ %d,%d)\n", bc - 32, xc - 32, yc - 32); printf("1005? ");
for (const char *p = resp; *p; p++)
printf("%c", *p < 32 || *p > 127 ? '.' : *p);
printf("\n");
} else {
printf("1000/1005 (%d @ %d,%d)\n", bc - 32, xc - 32, yc - 32);
}
} else if (sscanf(resp, CSI "<%u;%u;%u%c", &b, &x, &y, &m) == 4 } else if (sscanf(resp, CSI "<%u;%u;%u%c", &b, &x, &y, &m) == 4
&& (m == 'm' || m == 'M')) { && (m == 'm' || m == 'M')) {
printf("%s (%u%c @ %u,%u)\n", printf("%s (%u%c @ %u,%u)\n",
@ -323,6 +329,7 @@ int main(int argc, char *argv[]) {
// so we'd have to use Xlib, and that is too much effort. // so we'd have to use Xlib, and that is too much effort.
char *pasted = comm(CSI "?2004h" "Paste something: ", true); char *pasted = comm(CSI "?2004h" "Paste something: ", true);
printf("%d\n", !strncmp(pasted, CSI "200~", 6)); printf("%d\n", !strncmp(pasted, CSI "200~", 6));
comm(CSI "?2004l", false);
// Let the user see the results when run outside an interactive shell. // Let the user see the results when run outside an interactive shell.
comm("-- Finished\n", true); comm("-- Finished\n", true);