Fix diff context restoring for diff opened directly via 'tig show'
commit4028125bc58c727482a909f8275bd4fa4999a4f4
authorJonas Fonseca <jonas.fonseca@gmail.com>
Thu, 4 Sep 2014 11:19:51 +0000 (4 07:19 -0400)
committerJonas Fonseca <jonas.fonseca@gmail.com>
Thu, 4 Sep 2014 11:19:51 +0000 (4 07:19 -0400)
treef5686b8f7f2a7c766a3acbac4e8f0504e05782da
parent1d6b7df7205652c424661833d41ec4aeb8341ea0
Fix diff context restoring for diff opened directly via 'tig show'

The code that allows to jump to a line when opening a view from the
command line (e.g. `tig +10`) conflicted with diff context restoring
since it always restored using `view->env->lineno` regardless of whether
it was the view's first rendering or not. Furthermore, since diff_select
sets `view->env->lineno` this lead to strange line jumps.

The bug is fixed by using `view->prev_pos` for implementing `+<lineno>`
and ensuring that it only happens for the initial view rendering.
12 files changed:
NEWS.adoc
src/view.c
test/blame/start-on-line-test [new file with mode: 0755]
test/diff/diff-context-test
test/diff/start-on-line-test [new file with mode: 0755]
test/grep/start-on-line-test [new file with mode: 0755]
test/log/start-on-line-test [new file with mode: 0755]
test/main/start-on-line-test [new file with mode: 0755]
test/refs/start-on-line-test [new file with mode: 0755]
test/stash/start-on-line-test [new file with mode: 0755]
test/status/start-on-line-test [new file with mode: 0755]
test/tools/libgit.sh