static void screen_scroll_down(Screen *s) { RowIterator iter = RowMapLowerBound(rowmap(s), key(s)); if (iter != RowMapEnd(rowmap(s))) { iter++; if (iter != RowMapEnd(rowmap(s))) set_key(s, RowGetKey(iter)); } }
/* * Render the whole screen by querying the model. */ static void screen_render(Screen *s) { /* determine the visible set of rows using key */ RowIterator iter = RowMapLowerBound(rowmap(s), key(s)); RowIterator end = RowMapEnd(rowmap(s)); /* reposition the cursor to the origin */ int i = 0; int ctr = 0; move(ctr, 0); /* display the header row in reverse video at the top of screen */ attron(A_REVERSE); render_row(s, &s->model->header, '|'); attroff(A_REVERSE); ctr++; /* render visible set */ for (; iter != end && ctr < lines(s); iter++, ++ctr) { render_row(s, iter, ' '); } /* blank out any remaining rows below the last row */ for (i = ctr; i < lines(s); ++i) { printw("\n"); clrtoeol(); } }
void RowMapErase(RowMap *m, Row *key) { RowIterator iter = RowMapFindWithKey(m, key); if (iter == RowMapEnd(m)) return; RowCleanup(GetRow(iter)); bsd_rb_tree_remove_node(&m->tree, iter); }