Robert J. Morales wrote:
> As demonstrated in the test program below, AG_Console will not properly
> "auto-scroll" as is documented.
>
> Another demonstrated bug is that the scrollbar's "box" will draw itself
> outside of the actual scrollbar.
Ok, I managed to fix the auto-scrolling behavior by making a very simple change
to AG_ConsoleAppendLine().
The bug with the scrollbar remains, however.
----------------------------------------------------------------------
AG_ConsoleLine *
AG_ConsoleAppendLine(AG_Console *cons, const char *s)
{
AG_ConsoleLine *ln;
int max_lines;
AG_ObjectLock(cons);
cons->lines = Realloc(cons->lines, (cons->nLines+1) *
sizeof(AG_ConsoleLine));
ln = &cons->lines[cons->nLines++];
if (s != NULL) {
ln->text = Strdup(s);
ln->len = strlen(s);
} else {
ln->text = NULL;
ln->len = 0;
}
ln->cons = cons;
ln->selected = 0;
ln->p = NULL;
ln->font = NULL;
ln->surface = -1;
ln->cBg = AG_MapRGBA(agVideoFmt, 0,0,0,0);
ln->cFg = AG_MapRGB(agVideoFmt, 250,250,230);
max_lines = (cons->r.h / agTextFontHeight) - 1;
if (cons->nLines > max_lines)
cons->rOffs = cons->nLines - max_lines;
AG_ObjectUnlock(cons);
return (ln);
}
_______________________________________________
Agar mailing list
[email protected]
http://libagar.org/lists.html