Skip to content

Commit

Permalink
Fix updating of the blob ref and the blob view ref
Browse files Browse the repository at this point in the history
So now pressing 'f' on a tree link won't open a blank blob view. Also, the
blob reference shown in the title bar is always up to date.
  • Loading branch information
jonas authored and Jonas Fonseca committed Sep 12, 2006
1 parent d4d8de8 commit 73c76ef
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions tig.c
Expand Up @@ -2601,28 +2601,24 @@ tree_enter(struct view *view, struct line *line)

open_view(view, request, flags);

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;
}

return TRUE;
}

static void
tree_select(struct view *view, struct line *line)
{
if (line->type == LINE_TREE_DIR || line->type == LINE_TREE_FILE) {
char *text = line->data;
char *text = line->data;

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);

string_ncopy(view->ref, text + STRING_SIZE("100644 blob "), 40);
string_copy(ref_blob, view->ref);
} else if (line->type == LINE_TREE_DIR) {
string_ncopy(view->ref, text, 40);
}
}

Expand Down

0 comments on commit 73c76ef

Please sign in to comment.