From 73c76ef5c12ef914484e1ee71e55126d74020c8d Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Tue, 12 Sep 2006 02:05:17 +0200 Subject: [PATCH] Fix updating of the blob ref and the blob view ref 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. --- tig.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/tig.c b/tig.c index 66c5f76..6236bf3 100644 --- a/tig.c +++ b/tig.c @@ -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); } } -- 2.11.0