-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does not recognise modifier keys #17
Comments
+1 This would be very useful. |
Note that clojure-lanterna doesn't check for modifier keys. There's an issue and PR at MultiMUD/clojure-lanterna#17 MultiMUD/clojure-lanterna#18 in the meantime, can either resort to Java interop for just those sections, or (as clojure-lanterna library is looking fairly unmaintained) fork it, or simply use interop?
v0.10.0 will include this: (require '[lanterna.terminal :as t]
'[lanterna.api :as api])
(let [term (-> (t/get-terminal :swing) api/start)
stroke (api/get-stroke term)]
(api/stop term)
stroke)
;; hitting alt-a (on BSD) => {:key \a, :ctrl false, :alt true, :shift false} |
@MultiMUD Will the If you want to keep backwards compatibility (always a good idea, and a proud tradition in Clojure-land), a simple way could be to just add functions Please keep my suggestion in mind, and thanks for the nice library! |
@fromheten backwards compatibility was a requirement when handing over the repository & project from @sjl. To achieve this, there will be a split in API between 0.9.7 (current and last release by @sjl) and 0.10.0: The terminal and screen API will remain unchanged, maybe even a bit extended, with the mindset that this is the "low level", stable API. On top of this there will be a (protocol driven) generic API for all things drawing in lanterna3, terminals, screens and textgraphics. This allows experimentation for a more clojurey API on a higher layer, while current code will remain to function as expected with an updated clojure-lanterna. The only thing that changes from the low-level API is the return value (for any side-effecting fn this will return the context object (the first argument to the functions, a terminal or screen) as to permit So to directly answer your question: get-key returns a keycode constant now, and it will continue doing so. To get the map version, use |
@MultiMUD all right, if I understand you correctly it will be backwards compatible. Cheers |
Indeed. I'd consider it a bug if it isn't (save for the one-offs that make programming and design so beautiful :) ) |
The functions
get-key
andget-key-blocking
are giving you all keys pressed. But they don't seem to recognise the Control, Alt & super (and on Mac Command) keys.For instance,
get-key
returns 'å' when I hit Alt-a on my mac keyboard. Ctrl and any character just returns the character. It would be nice to let the program get{:mod :ctrl :key "a"}
or something like that.The text was updated successfully, but these errors were encountered: