Code

Cleanup bluring of the previous view's title bar
[tig.git] / tig.c
diff --git a/tig.c b/tig.c
index 222b3698de6bcc60395ab74519b4c9048e2e5ed6..e2ae80dfb703e3f55057cf5719d58e8ae100a32b 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -137,7 +137,7 @@ struct ref_list {
 };
 
 static struct ref_list *get_ref_list(const char *id);
-static void foreach_ref(bool (*visitor)(void *data, struct ref *ref), void *data);
+static void foreach_ref(bool (*visitor)(void *data, const struct ref *ref), void *data);
 static int load_refs(void);
 
 enum format_flags {
@@ -3236,11 +3236,9 @@ open_view(struct view *prev, enum request request, enum open_flags flags)
                do_scroll_view(prev, lines);
        }
 
-       if (prev && view != prev) {
-               if (split) {
-                       /* "Blur" the previous view. */
-                       update_view_title(prev);
-               }
+       if (prev && view != prev && split && view_is_displayed(prev)) {
+               /* "Blur" the previous view. */
+               update_view_title(prev);
        }
 
        if (view->pipe && view->lines == 0) {
@@ -5036,7 +5034,7 @@ static struct view_ops blame_ops = {
 struct branch {
        const char *author;             /* Author of the last commit. */
        time_t time;                    /* Date of the last activity. */
-       struct ref *ref;                /* Name and commit ID information. */
+       const struct ref *ref;          /* Name and commit ID information. */
 };
 
 static const enum sort_field branch_sort_fields[] = {
@@ -5144,7 +5142,7 @@ branch_read(struct view *view, char *line)
 }
 
 static bool
-branch_open_visitor(void *data, struct ref *ref)
+branch_open_visitor(void *data, const struct ref *ref)
 {
        struct view *view = data;
        struct branch *branch;
@@ -5882,10 +5880,8 @@ status_request(struct view *view, enum request request, struct line *line)
                break;
 
        case REQ_VIEW_BLAME:
-               if (status) {
-                       string_copy(opt_file, status->new.name);
+               if (status)
                        opt_ref[0] = 0;
-               }
                return request;
 
        case REQ_ENTER:
@@ -5952,6 +5948,8 @@ status_select(struct view *view, struct line *line)
        }
 
        string_format(view->ref, text, key, file);
+       if (status)
+               string_copy(opt_file, status->new.name);
 }
 
 static bool
@@ -7207,7 +7205,7 @@ compare_refs(const void *ref1_, const void *ref2_)
 }
 
 static void
-foreach_ref(bool (*visitor)(void *data, struct ref *ref), void *data)
+foreach_ref(bool (*visitor)(void *data, const struct ref *ref), void *data)
 {
        size_t i;