Implement mouse catching also in CSI driver, in case xterm-alike terminal without 'key_mouse' terminfo string

This commit is contained in:
Paul LeoNerd Evans 2009-11-26 00:33:30 +00:00
parent c4bc0486d4
commit 6dc2b9c72b
1 changed files with 16 additions and 0 deletions

View File

@ -235,6 +235,22 @@ static TermKeyResult peekkey_csi(TermKey *tk, TermKeyCsi *csi, size_t introlen,
return TERMKEY_RES_NONE; return TERMKEY_RES_NONE;
} }
} }
else if(cmd == 'M') {
size_t csi_len = csi_end + 1;
tk->buffstart += csi_len;
tk->buffcount -= csi_len;
TermKeyResult mouse_result = (*tk->method.peekkey_mouse)(tk, key, nbytep);
tk->buffstart -= csi_len;
tk->buffcount += csi_len;
if(mouse_result == TERMKEY_RES_KEY)
*nbytep += csi_len;
return mouse_result;
}
else { else {
// We know from the logic above that cmd must be >= 0x40 and < 0x80 // We know from the logic above that cmd must be >= 0x40 and < 0x80
key->type = csi->csi_ss3s[cmd - 0x40].type; key->type = csi->csi_ss3s[cmd - 0x40].type;