diff --git a/src/blame.c b/src/blame.c index 335c251a7..2c0d2942a 100644 --- a/src/blame.c +++ b/src/blame.c @@ -173,8 +173,6 @@ blame_open(struct view *view, enum open_flags flags) free(blame->commit); } - if (!(flags & OPEN_RELOAD)) - reset_view_history(&blame_view_history); string_copy_rev(state->history_state.id, view->env->ref); state->history_state.filename = get_path(view->env->file); if (!state->history_state.filename) @@ -455,6 +453,8 @@ blame_request(struct view *view, enum request request, struct line *line) enum open_flags flags = view_is_displayed(view) ? OPEN_SPLIT : OPEN_DEFAULT; struct blame *blame = line->data; struct view *diff = &diff_view; + struct blame_state *state = view->private; + struct blame_history_state *history_state = &state->history_state; switch (request) { case REQ_VIEW_BLAME: @@ -476,6 +476,11 @@ blame_request(struct view *view, enum request request, struct line *line) !strcmp(blame->commit->id, diff->ref)) break; + if (!push_view_history_state(&blame_view_history, &view->pos, history_state)) { + report("Failed to save current view state"); + break; + } + if (string_rev_is_null(blame->commit->id)) { const char *diff_parent_argv[] = { GIT_DIFF_BLAME(encoding_arg, diff --git a/src/view.c b/src/view.c index 9980e3a2f..52c808d13 100644 --- a/src/view.c +++ b/src/view.c @@ -393,7 +393,7 @@ push_view_history_state(struct view_history *history, struct position *position, if (state && data && history->state_alloc && !memcmp(state->data, data, history->state_alloc)) - return NULL; + return state; state = calloc(1, sizeof(*state) + history->state_alloc); if (!state)