shithub: vdiff

Download patch

ref: 7f0615a3a9943e31b1e2aa6b979c08f9b2cf5a25
parent: 178f835c225c2aa3f59a2b226caa18080f613f62
author: phil9 <telephil9@gmail.com>
date: Sun Dec 5 00:24:29 EST 2021

do not reset scroll position upon window resize (thanks qwx)

	scroll position was reset to 0 when the window was resized.
	We now restore the proper scroll position instead.

--- a/vdiff.c
+++ b/vdiff.c
@@ -138,8 +138,9 @@
 	textr = insetrect(listr, Margin);
 	lineh = Vpadding+font->height+Vpadding;
 	nlines = Dy(textr)/lineh;
-	offset = 0;
 	scrollsize = mousescrollsize(nlines);
+	if(offset > 0 && offset+nlines>lcount)
+		offset = lcount-nlines+1;
 	redraw();
 }