guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

termbox bindings


From: Amirouche
Subject: termbox bindings
Date: Sun, 23 Apr 2017 21:43:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

Azul!

I craftedsome ffi bindings for termbox [1] which is a small library
that allows to interact with the terminal (somewhat like ncurses but much
simpler).

It comes with a toy text editor with rainbow highlighting and some emacs
bindings. I tried to implement keyword highlighting but it was slow. Also
it use finger trees (a (special) persistent functional datastructure from
pfds) to represent the buffer [4]. The editor itself is less than 400 lines of
beautiful scheme code, so you can read it:

  git clone https://github.com/amirouche/azul.scm

By the way, azul means hello in amazigh!

Hope this helps!

[1] The official repository of termbox is [2] but [3] has some bugfix
[2] https://github.com/nsf/termbox/
[3] https://github.com/tomas/termbox
[4] Custom finger tree (ft) datastructure for the buffer is in buffer.scm.
You don't need to understand ft to read the code, because I implement higher level procedure that interact with the ft like a regular list. Haskell editor
    use fingertrees too, but IDK exactly how they use finger trees.
The actual buffer use that indexed list datastructre two times, a first time to represent the lines. And another time to represent each line. And because
    chars are represented as integers the buffer is a ft of ft of integers.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]