whichtree = term->scrollback; treeindex = y + count234(term->scrollback);
int altlines = 0; if (term->cfg.erase_to_scrollback && term->alt_which && term->alt_screen) { altlines = term->alt_sblines; } if (y < -altlines) { whichtree = term->scrollback; treeindex = y + altlines + count234(term->scrollback); } else { whichtree = term->alt_screen; treeindex = y + term->alt_sblines;  }
static unsigned long *lineptr(Terminal *term, int y, int lineno){    unsigned long *line, *newline;    tree234 *whichtree;    int treeindex;    if (y >= 0) {	whichtree = term->screen;	treeindex = y;    } else {	whichtree = term->scrollback;	treeindex = y + count234(term->scrollback);    }    line = index234(whichtree, treeindex);    /* We assume that we don't screw up and retrieve something out of range. */    assert(line != NULL);    newline = resizeline(line, term->cols);    if (newline != line) {	delpos234(whichtree, treeindex);	addpos234(whichtree, newline, treeindex);        line = newline;    }    return line + 1;}