Inspiration

Node's "blessed" and "blessed-contrib" package, which is built on termcap and terminfo.

What it does

Ashen is an application framework, and so you use it to build Terminal applications. My hackathon submission is a demonstration of Ashen's capabilities and design, and I used this time to implement components that I used in the demos, like a "canvas", which can mimic pixels using braille characters.

The video shows the demo in action - please note that it is just a terminal, not an NSWindow "mimicing" a terminal UI. The character drawing is built on top of Ncurses.

How I built it

The drawing is done with ncurses, the rest is all custom Swift code. The bulk of the run loop is a map/reduce loop that takes a model, renders it, receives messages from a message queue (via event-emitting components), and uses those to update the model, and render the new output.

Challenges I ran into

Performant screen refreshes, and designing a "purely functional" but also pragmatic API.

Accomplishments that I'm proud of

The InputView, which is how you can enter text. Supports multiple lines and selection. And of course the functional design! It makes rendering/view code really simple, and the "message / action -> new model" cycle (the "React / Elm" paradigm) is really easy to test and reason about.

What I learned

A bit about Ncurses, and it has some very crusty edges.

What's next for Ashen.

Mouse events need to be fleshed out, more Components, and a better "Command" forwarding system would be nice.

Built With

Share this project:
×

Updates