Comments (6)
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}
from clojure-lanterna.
+1 This would be very useful.
There is #18 which provides behaviour similar to what is being asked for. :)
from clojure-lanterna.
@MultiMUD Will the get-key
function then sometimes return a string and sometimes a map?
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 get-key-with-modifier
& get-key-with-modifier-blocking
which always return a map like {:key \a, :ctrl false, :alt true, :shift false}
.
Please keep my suggestion in mind, and thanks for the nice library!
from clojure-lanterna.
@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 (->)
chaining of the fns. Check out the lanterna3 branch for a mid-development state snapshot.
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 get-stroke
(a new fn) from either the low-level, or the API namespace.
from clojure-lanterna.
@MultiMUD all right, if I understand you correctly it will be backwards compatible. Cheers
from clojure-lanterna.
Indeed. I'd consider it a bug if it isn't (save for the one-offs that make programming and design so beautiful :) )
from clojure-lanterna.
Related Issues (10)
- Corrupted characters on fresh ubuntu install HOT 3
- Redraw writes green X's HOT 5
- Add put-sheet to the clojars repository! HOT 1
- Can't require, java error. HOT 2
- Odd characters in Hello, World example HOT 2
- support panel? HOT 2
- Feature Request: Hide Cursor
- Obtain character at coordinates?
- Plans on development?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clojure-lanterna.