unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* termbox bindings
@ 2017-04-23 19:43 Amirouche
  2017-04-23 22:43 ` Amirouche
  0 siblings, 1 reply; 3+ messages in thread
From: Amirouche @ 2017-04-23 19:43 UTC (permalink / raw)
  To: guile-user@gnu.org

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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: termbox bindings
  2017-04-23 19:43 termbox bindings Amirouche
@ 2017-04-23 22:43 ` Amirouche
  2017-04-24 19:15   ` Amirouche
  0 siblings, 1 reply; 3+ messages in thread
From: Amirouche @ 2017-04-23 22:43 UTC (permalink / raw)
  To: guile-user



Le 23/04/2017 à 21:43, Amirouche a écrit :
> Azul!
>
> I crafted some 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.

FWIW, I commited a better implementation, that could use some more love
that doesn't show any slow-ish behavior. It's only a "keyword" 
hilighter, more
work would be required to also highlight comments and strings.

I don't want you to believe that Guile is slow in such a simple editor.

Also, there is giant bug, where it's not possible to split a line!

Here is screenshot of the thing http://imgur.com/a/mrJ9J

See you next week end for new adventures!



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: termbox bindings
  2017-04-23 22:43 ` Amirouche
@ 2017-04-24 19:15   ` Amirouche
  0 siblings, 0 replies; 3+ messages in thread
From: Amirouche @ 2017-04-24 19:15 UTC (permalink / raw)
  To: guile-user

Le 24/04/2017 à 00:43, Amirouche a écrit :
>
> Also, there is giant bug, where it's not possible to split a line! 

I fixed it in 
https://github.com/amirouche/azul.scm/commit/9bc643661e20d19dadc906efdbb413ae658b5573



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-24 19:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-23 19:43 termbox bindings Amirouche
2017-04-23 22:43 ` Amirouche
2017-04-24 19:15   ` Amirouche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).