2011/09/30

libvterm/pangoterm and Tickit

Lately I've written a bit about my terminal emulator library, libvterm, and briefly mentioned Tickit, my terminal UI module for Perl. I'll write about each in more detail soon, but I thought since I hit an important milestone recently, I'd write a little something more about libvterm and pangoterm.

libvterm is a purely abstract C99 library that implements the bulk of the logic of being a terminal emulator. Bytes from the PTY master are fed into it by the containing program, and it maintains the abstract state of the terminal; the position of the cursor, the state of the pen, what charcters are where with what attributes, and so on. It calls callback functions registered by the containing program, to inform it of damaged screen regions that need repainting. Two of the main selling points of the library are
  • It is purely abstract C99, doesn't rely on POSIX or any particular rendering/UI system

  • During normal operation of just feeding it bytes and processing events, it does not use the malloc system.
These properties make it ideal for a number of situations, ranging from desktop applications, to small embedded systems or operating system kernels.

pangoterm is a GTK/Pango-driven embedding of this libary, in a simple single-.c-file application, mostly for me to develop and test it. It is currently maintained in the libvterm source tree.

For a while now this combination has been complete enough to drive vim sufficient to edit its own source code - pangoterm and libvterm are now self-hosting. A couple of weeks ago I finally managed to fix the last of a number of small issues making it not quite perfect. Last week I also managed to get pangoterm to completely correctly render a Tickit-based program; the final missing piece being some of the mouse tracking modes.

I now have a bit of extra configuration in my .vimrc to take advantage of a few of pangoterm's abilities, such as support for italics.


As well as italics, it also supports strikethrough and alternative fonts, although so far I've only managed to find one alternative font that actually looks at all decent alongside DejaVu Sans Mono. These are all shown off quite well by Tickit's demo-pen.pl example script here.


And finally here, a demo of the xterm-like 256 colour handling.


These screenshots briefly show Tickit working nicely with pangoterm. Sometime soon I shall get around to writing about Tickit in more detail, and also explaining some of my further plans for the whole Tickit+libtermkey vs libvterm combination.

4 comments:

  1. Do you have a terminfo definition for your terminal? This is a basic feature I expect from a terminal emulator.

    ReplyDelete
  2. The lack of a proper terminfo entry is probably the reason why you need this dirty application-specific tweak (the Vim config).

    ReplyDelete
  3. Nope; no terminfo. The main reason being that this really ought to be a complete clone of xterm, with all of its abilities. It simply exports TERM=xterm.
    Creating a new termtype, and then adding a terminfo database entry is really quite difficult - not only does it have to be included on the local machine, but on any machine I would ssh into. I don't fancy my chances at getting that into every major Linux distro, BSD fork, Solaris, etc etc...
    Furthermore, the very idea of terminfo as a concept doesn't really apply to modern terminals - notice all the named variants of "xterm" or "screen" for example, to cover various combinations of compiled-in or enabled features. I think long term this isn't something we can continue sustaining, and in my opinion the sooner we can get rid of it the better.

    ReplyDelete
  4. Recently, I’ve found some newly created micro niche site focus on “Holiday Gift Buying Guides” with really good guide for shopper tekken 3 games free download

    ReplyDelete