Beispiel #1
0
/* debugging funcs */
void
RowDump(Row *row)
{
	size_t i = 0;

	for (i = 0; i < RowSize(row); ++i)
		printf("%.*s ", (int) RowFieldLength(row, i), RowFieldValue(row, i));

	printf("\n");
}
Beispiel #2
0
/*
 * Render a row, taking column, x_pos and padding into account.
 *
 * Note - render in this context means send the data to ncurses, the tty
 * 		  won't be updated until refresh() is called
 */
static inline void
render_row(Screen *s, Row *row, char sep)
{
	size_t i = 0;

	for (i = s->x_col; i < RowSize(row); ++i)
	{
		size_t padlen = maxlen(s, i);

		char *fv = RowFieldValue(row, i);
		size_t fn = RowFieldLength(row, i);

		if (i == s->x_col) {

			if (s->x_pos < fn) {

				printw("%s", fv + s->x_pos);
				printwpad(padlen - fn);
			}
			else {
				printwpad(padlen - s->x_pos);
			}
		}
		else
		{
			printw("%s", fv);
			printwpad(padlen - fn);
		}

		if (i != (RowSize(row) - 1))
			printw("%c", sep);
	}

	clrtoeol();
	printw("\n");
}