mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 10:27:41 +00:00
In insert_file_contents, always set windows' point markers.
This fixes bug #51776. * src/fileio.c (restore_window_points): Restore a w->mpoint even when that marker originally pointed into the unchanged area near BOB or EOB. This prevents that window's point being moved a long way from its starting place due to the removal of the central part of the buffer by insert_file_contents.
This commit is contained in:
parent
2c5be6ddca
commit
974192413f
1 changed files with 6 additions and 3 deletions
|
|
@ -3827,6 +3827,7 @@ 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)
|
||||
|
|
@ -3834,10 +3835,12 @@ restore_window_points (Lisp_Object window_markers, ptrdiff_t inserted,
|
|||
ptrdiff_t oldsize = same_at_end - same_at_start;
|
||||
ptrdiff_t newsize = inserted;
|
||||
double growth = newsize / (double)oldsize;
|
||||
ptrdiff_t newpos
|
||||
= same_at_start + growth * (XFIXNUM (oldpos) - same_at_start);
|
||||
Fset_marker (marker, make_fixnum (newpos), Qnil);
|
||||
newpos = same_at_start
|
||||
+ growth * (XFIXNUM (oldpos) - same_at_start);
|
||||
}
|
||||
else
|
||||
newpos = XFIXNUM (oldpos);
|
||||
Fset_marker (marker, make_fixnum (newpos), Qnil);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue