From: Alan Mackenzie Date: Sat, 13 Nov 2021 12:58:23 +0000 (+0000) Subject: Correct patch from 2021-11-12 on src/fileio.c X-Git-Tag: emacs-29.0.90~2852^2~309 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f740becf8ad1fdd992fb509edb10ff041f163c8f;p=emacs.git Correct patch from 2021-11-12 on src/fileio.c * src/fileio.c (restore_window_points): Reverse commit 974192413f8a81171b8fd28dfd5c081ce06d3dec and instead replace a < by a <=. This ensures that if w->mpoint is at the top of the middle region being replaced, it gets adjusted and stays at the top after the reinsertion. --- diff --git a/src/fileio.c b/src/fileio.c index a7b1649fae8..4015448ecee 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3827,20 +3827,17 @@ restore_window_points (Lisp_Object window_markers, ptrdiff_t inserted, Lisp_Object car = XCAR (window_markers); Lisp_Object marker = XCAR (car); Lisp_Object oldpos = XCDR (car); - ptrdiff_t newpos; if (MARKERP (marker) && FIXNUMP (oldpos) && XFIXNUM (oldpos) > same_at_start - && XFIXNUM (oldpos) < same_at_end) + && XFIXNUM (oldpos) <= same_at_end) { ptrdiff_t oldsize = same_at_end - same_at_start; ptrdiff_t newsize = inserted; double growth = newsize / (double)oldsize; - newpos = same_at_start - + growth * (XFIXNUM (oldpos) - same_at_start); + ptrdiff_t newpos + = same_at_start + growth * (XFIXNUM (oldpos) - same_at_start); + Fset_marker (marker, make_fixnum (newpos), Qnil); } - else - newpos = XFIXNUM (oldpos); - Fset_marker (marker, make_fixnum (newpos), Qnil); } }