Re: [dev] [st] Separating the wheat (terminal emulation) from the chaff (X)

From: Aurélien Aptel <aurelien.aptel_AT_gmail.com>
Date: Wed, 19 Jan 2011 00:44:28 +0100

What the API should look like? Which features?
I was thinking of something like this:

* term_ function prefix
* first parameter is the term context
* non blocking io (ie. returns when there's nothing to process)
* use a dirty flag on glyph (or even on lines) to speed up drawing
* scrollback buffer, by popular demand

/* usage example */
term_t* t = term_new(width, height, "/bin/sh");

while(1) {
    /* non blocking behaviour */
    flag = term_update(t);

    /* content of the screen changed */
    if(flag & DIRTY)
        draw_update(t);
    /* bell received */
    if(flag & BELL)
        beep();
    /* title changed */
    if(flag & TITLE)
        set_title(t->title);
    /* cursor moved (we have to remove the old one and draw the new one) */
    if(flag & CURSOR)
       redraw_cursor();
    /* shell exited */
    if(flag & DEAD)
       die("argh");

    if(key_pressed())
        term_write(t, key);
    if(window_resize())
        term_resize(t, new_width, new_height)

    /* ... */
}

Do selection-type actions have their place in the lib? Is the
selection per terminal? If I select a chunk of text before the screen
scrolls, do I keep the selected text and scroll the selection with it,
or do I keep the selection position and update the selection buffer?
Received on Wed Jan 19 2011 - 00:44:28 CET

This archive was generated by hypermail 2.2.0 : Wed Jan 19 2011 - 00:48:03 CET