Prevent strange echo feedback loops (!)
This is very rare, but a problem that needs a bounds check, in my case:
- telnet LINE MODE is incorrectly negotiated (should be "kludge")
- blessed's _query_response enters cbreak mode
- blessed writes \x1b[?u\x1b[c (kitty keyboard query + DA1 query)
- in LINE MODE with local echo, the query gets echoed to the terminal
- the terminal emulator sees the echoed escape sequence and responds
- this response also gets echoed, creating an infinite echo loop
So anyway, I miswired it when I failed to await linemode negotiation
before launching a program, but anyway its a useful thing to prevent
from falling into infinite memory use.
bugfix kitty keyboard protocol detection
The boundary pattern in ``get_kitty_keyboard_state()`` used ``.+`` which matched prematurely!
Existing tests didn't catch this because they use ungetch() which buffers the entire response