#define SIZEOF_STR 1024 /* Default string size. */
#define SIZEOF_REF 256 /* Size of symbolic or SHA1 ID. */
#define SIZEOF_STR 1024 /* Default string size. */
#define SIZEOF_REF 256 /* Size of symbolic or SHA1 ID. */
#define SIZEOF_REVGRAPH 19 /* Size of revision ancestry graphics. */
/* This color name can be used to refer to the default term colors. */
#define SIZEOF_REVGRAPH 19 /* Size of revision ancestry graphics. */
/* This color name can be used to refer to the default term colors. */
unsigned int tag:1; /* Is it a tag? */
unsigned int next:1; /* For ref lists: are there more refs? */
};
unsigned int tag:1; /* Is it a tag? */
unsigned int next:1; /* For ref lists: are there more refs? */
};
LINE(AUTHOR, "author ", COLOR_CYAN, COLOR_DEFAULT, 0), \
LINE(COMMITTER, "committer ", COLOR_MAGENTA, COLOR_DEFAULT, 0), \
LINE(SIGNOFF, " Signed-off-by", COLOR_YELLOW, COLOR_DEFAULT, 0), \
LINE(AUTHOR, "author ", COLOR_CYAN, COLOR_DEFAULT, 0), \
LINE(COMMITTER, "committer ", COLOR_MAGENTA, COLOR_DEFAULT, 0), \
LINE(SIGNOFF, " Signed-off-by", COLOR_YELLOW, COLOR_DEFAULT, 0), \
LINE(DEFAULT, "", COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL), \
LINE(CURSOR, "", COLOR_WHITE, COLOR_GREEN, A_BOLD), \
LINE(STATUS, "", COLOR_GREEN, COLOR_DEFAULT, 0), \
LINE(DEFAULT, "", COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL), \
LINE(CURSOR, "", COLOR_WHITE, COLOR_GREEN, A_BOLD), \
LINE(STATUS, "", COLOR_GREEN, COLOR_DEFAULT, 0), \
return view->ops->draw(view, line, lineno, selected);
}
return view->ops->draw(view, line, lineno, selected);
}
/* Move the cursor to the right-most column of the cursor line.
*
* XXX: This could turn out to be a bit expensive, but it ensures that
/* Move the cursor to the right-most column of the cursor line.
*
* XXX: This could turn out to be a bit expensive, but it ensures that
+ /* Move current line into the view. */
+ if (view->lineno < view->offset) {
+ view->lineno = view->offset;
+ redraw_current_line = TRUE;
+ } else if (view->lineno >= view->offset + view->height) {
+ view->lineno = view->offset + view->height - 1;
+ redraw_current_line = TRUE;
+ }
+
+ assert(view->offset <= view->lineno && view->lineno < view->lines);
+
- }
-
- /* Move current line into the view. */
- if (view->lineno < view->offset) {
- view->lineno = view->offset;
- draw_view_line(view, 0);
- } else if (view->lineno >= view->offset + view->height) {
- if (view->lineno == view->offset + view->height) {
- /* Clear the hidden line so it doesn't show if the view
- * is scrolled up. */
- wmove(view->win, view->height, 0);
- wclrtoeol(view->win);
- }
- view->lineno = view->offset + view->height - 1;
- draw_view_line(view, view->lineno - view->offset);
+ if (redraw_current_line)
+ draw_view_line(view, view->lineno - view->offset);
- /* Repaint the old "current" line if we be scrolling */
- if (ABS(steps) < view->height) {
- int prev_lineno = view->lineno - steps - view->offset;
-
- wmove(view->win, prev_lineno, 0);
- wclrtoeol(view->win);
- draw_view_line(view, prev_lineno);
- }
-
/* Check whether the view needs to be scrolled */
if (view->lineno < view->offset ||
view->lineno >= view->offset + view->height) {
/* Check whether the view needs to be scrolled */
if (view->lineno < view->offset ||
view->lineno >= view->offset + view->height) {
- steps = view->lines - view->offset - 1;
- if (steps >= view->height)
- steps -= view->height - 1;
+ scroll_steps = view->lines - view->offset - 1;
+ if (scroll_steps >= view->height)
+ scroll_steps -= view->height - 1;
- do_scroll_view(view, steps, redraw);
+ if (!view_is_displayed(view)) {
+ view->offset += steps;
+ view->ops->select(view, &view->line[view->lineno]);
- /* Draw the current line */
- draw_view_line(view, view->lineno - view->offset);
+ /* Repaint the old "current" line if we be scrolling */
+ if (ABS(steps) < view->height)
+ draw_view_line(view, view->lineno - steps - view->offset);
draw_view_line(view, old_lineno);
draw_view_line(view, view->lineno - view->offset);
draw_view_line(view, old_lineno);
draw_view_line(view, view->lineno - view->offset);
view->parent == VIEW(REQ_VIEW_MAIN)) ||
(view == VIEW(REQ_VIEW_BLOB) &&
view->parent == VIEW(REQ_VIEW_TREE))) {
view->parent == VIEW(REQ_VIEW_MAIN)) ||
(view == VIEW(REQ_VIEW_BLOB) &&
view->parent == VIEW(REQ_VIEW_TREE))) {
*
* 100644 blob fb0e31ea6cc679b7379631188190e975f5789c26 Makefile
* 100644 blob 5304ca4260aaddaee6498f9630e7d471b8591ea6 README
*
* 100644 blob fb0e31ea6cc679b7379631188190e975f5789c26 Makefile
* 100644 blob 5304ca4260aaddaee6498f9630e7d471b8591ea6 README
char *basename = data + SIZEOF_TREE_ATTR;
if (!string_format_from(opt_path, &pathlen, "%s/", basename)) {
char *basename = data + SIZEOF_TREE_ATTR;
if (!string_format_from(opt_path, &pathlen, "%s/", basename)) {
- if (!VIEW(request)->pipe)
- return TRUE;
-
- /* For tree views insert the path to the parent as the first line. */
- if (request == REQ_VIEW_BLOB) {
- /* Mirror what is showed in the title bar. */
- string_ncopy(ref_blob, data + STRING_SIZE("100644 blob "), 40);
- string_copy(VIEW(REQ_VIEW_BLOB)->ref, ref_blob);
- return TRUE;
- }
-
- string_ncopy(view->ref, text + STRING_SIZE("100644 blob "), 40);
- string_copy(ref_blob, view->ref);
+ text += STRING_SIZE("100644 blob ");
+
+ if (line->type == LINE_TREE_FILE) {
+ string_ncopy(ref_blob, text, 40);
+ /* Also update the blob view's ref, since all there must always
+ * be in sync. */
+ string_copy(VIEW(REQ_VIEW_BLOB)->ref, ref_blob);
+
+ } else if (line->type != LINE_TREE_DIR) {
+ return;
char title[75]; /* First line of the commit message. */
char author[75]; /* Author of the commit. */
struct tm time; /* Date from the author ident. */
char title[75]; /* First line of the commit message. */
char author[75]; /* Author of the commit. */
struct tm time; /* Date from the author ident. */