Closed thetek42 closed 2 years ago
Would be interesting to see if the key presses reach the terminal input buffer at all if the mouse is moving (mouse coordinates also gets reported via terminal buffer), if yes its a bug
My guess is that any other key simply gets overridden if the mouse is active.
From illwill.nim, line 642 onwards:
proc parseKey(charsRead: int): Key =
var key = Key.None
if charsRead == 1:
let ch = keyBuf[0]
case ch: #...
### Tab, Enter, Escape, Space and Backspace keys
else:
key = toKey(ch)
elif charsRead > 3 and keyBuf[0] == 27 and keyBuf[1] == 91 and keyBuf[2] == 60: # TODO what are these :)
fillGlobalMouseInfo(keyBuf)
### Key.Mouse is returned
return Key.Mouse
else:
### other keys
result = key
It would be neat if you could access keyboard keys with Key.Whatever
, and the mouse with Mouse
. This separation would also get rid of the bug, as the keypresses would not get overridden anymore as soon as mouse movement is detected.
If it's a bug, and it's fixable, maybe you can ask @enthus1ast nicely to raise a PR 😄 He introduced mouse support in the first place, I don't really need it and care too much for it, so it's unlikely I will work on this anytime soon.
Closing due to inactivity/lack of interest.
When you try to detect keypresses, they won't get detected when the mouse is moving at the same time.
Steps to reproduce:
git clone https://github.com/johnnovak/illwill
cd illwill/examples
nim c -r mouse.nim
System Details: