Reading how a block of code reached its current shape means stepping through
the file's history. Two things get in the way.
The cursor does not follow the code. cursor_map stores a raw winsaveview()
dict per path and restores the line number. Step to another revision and the
cursor sits on whatever code now occupies that number. After a 30-line prepend,
that is not the code you were reading.
And walking the history from a cursor position, I only want the commits that
changed the code there. Diffview folds away the unchanged parts of a diff, so
on the others the cursor ends up inside a fold with nothing to look at.
I have both parts implemented and can open them as two stacked PRs.
Step 1, carry the cursor. On each step the cursor moves to wherever its
line ended up in the new revision. If the commit rewrote that line, the cursor
goes to the start of the rewrite.
Step 2, walk to the next change under the cursor. Two new actions walk
between the commits that changed the code at the cursor. Commits that changed
the file somewhere else are skipped. The commit you stop on opens normally, so
you still see everything else it changed.
Reading how a block of code reached its current shape means stepping through
the file's history. Two things get in the way.
The cursor does not follow the code.
cursor_mapstores a rawwinsaveview()dict per path and restores the line number. Step to another revision and the
cursor sits on whatever code now occupies that number. After a 30-line prepend,
that is not the code you were reading.
And walking the history from a cursor position, I only want the commits that
changed the code there. Diffview folds away the unchanged parts of a diff, so
on the others the cursor ends up inside a fold with nothing to look at.
I have both parts implemented and can open them as two stacked PRs.
Step 1, carry the cursor. On each step the cursor moves to wherever its
line ended up in the new revision. If the commit rewrote that line, the cursor
goes to the start of the rewrite.
Step 2, walk to the next change under the cursor. Two new actions walk
between the commits that changed the code at the cursor. Commits that changed
the file somewhere else are skipped. The commit you stop on opens normally, so
you still see everything else it changed.