+static int
+pager_read(struct view *view, char *line)
+{
+ view->line[view->lines] = strdup(line);
+ if (!view->line[view->lines])
+ return FALSE;
+
+ view->lines++;
+ return TRUE;
+}
+
+static int
+main_draw(struct view *view, unsigned int lineno)
+{
+ struct commit *commit;
+ int attr = A_NORMAL;
+
+ if (view->offset + lineno >= view->lines)
+ return FALSE;
+
+ commit = view->line[view->offset + lineno];
+ if (!commit) return FALSE;
+
+ attr = attrs[0].attr;
+
+ if (view->offset + lineno == view->lineno) {
+ strncpy(commit_id, commit->id, SIZEOF_ID);
+ attr = COLOR_PAIR(COLOR_CURSOR) | A_BOLD;
+ }
+
+ mvwaddch(view->win, lineno, 0, ACS_LTEE);
+ wattrset(view->win, attr);
+ mvwaddstr(view->win, lineno, 2, commit->title);
+ wattrset(view->win, A_NORMAL);
+
+ return TRUE;
+}
+
+static int
+main_read(struct view *view, char *line)
+{
+ int linelen = strlen(line);
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(attrs); i++) {
+ if (linelen < attrs[i].linelen
+ || strncmp(attrs[i].line, line, attrs[i].linelen))
+ continue;
+ break;
+ }
+
+ if (i == 0) {
+ struct commit *commit;
+
+ commit = calloc(1, sizeof(struct commit));
+ if (!commit)
+ return FALSE;
+
+ view->line[view->lines++] = commit;
+
+ strncpy(commit->id, line + 7, 41);
+
+ } else {
+ struct commit *commit = view->line[view->lines - 1];
+
+ if (!commit->title[0] &&
+ linelen > 5 &&
+ !strncmp(line, " ", 4) &&
+ !isspace(line[5]))
+ strncpy(commit->title, line + 4, sizeof(commit->title));
+ }
+
+ return TRUE;
+}
+
+