Commit 03ab8921 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

Fix bug #7952 with vertical motion in Grep buffers.

 src/window.c (window_scroll_line_based): Use a marker instead of
 simple variables to record original value of point.
parent 7eabc1be
2011-04-29 Eli Zaretskii <eliz@gnu.org> 2011-04-29 Eli Zaretskii <eliz@gnu.org>
* window.c (window_scroll_line_based): Use a marker instead of
simple variables to record original value of point. (Bug#7952)
* doprnt.c (doprnt): Fix the case where a multibyte sequence * doprnt.c (doprnt): Fix the case where a multibyte sequence
produced by %s or %c overflows available buffer space. (Bug#8545) produced by %s or %c overflows available buffer space. (Bug#8545)
......
...@@ -5076,7 +5076,12 @@ static void ...@@ -5076,7 +5076,12 @@ static void
window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
{ {
register struct window *w = XWINDOW (window); register struct window *w = XWINDOW (window);
register EMACS_INT opoint = PT, opoint_byte = PT_BYTE; /* Fvertical_motion enters redisplay, which can trigger
fontification, which in turn can modify buffer text (e.g., if the
fontification functions replace escape sequences with faces, as
in `grep-mode-font-lock-keywords'). So we use a marker to record
the old point position, to prevent crashes in SET_PT_BOTH. */
Lisp_Object opoint_marker = Fpoint_marker ();
register EMACS_INT pos, pos_byte; register EMACS_INT pos, pos_byte;
register int ht = window_internal_height (w); register int ht = window_internal_height (w);
register Lisp_Object tem; register Lisp_Object tem;
...@@ -5126,7 +5131,8 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) ...@@ -5126,7 +5131,8 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
pos = PT; pos = PT;
pos_byte = PT_BYTE; pos_byte = PT_BYTE;
bolp = Fbolp (); bolp = Fbolp ();
SET_PT_BOTH (opoint, opoint_byte); SET_PT_BOTH (marker_position (opoint_marker),
marker_byte_position (opoint_marker));
if (lose) if (lose)
{ {
...@@ -5177,8 +5183,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) ...@@ -5177,8 +5183,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
else else
top_margin = pos; top_margin = pos;
if (top_margin <= opoint) if (top_margin <= marker_position (opoint_marker))
SET_PT_BOTH (opoint, opoint_byte); SET_PT_BOTH (marker_position (opoint_marker),
marker_byte_position (opoint_marker));
else if (!NILP (Vscroll_preserve_screen_position)) else if (!NILP (Vscroll_preserve_screen_position))
{ {
SET_PT_BOTH (pos, pos_byte); SET_PT_BOTH (pos, pos_byte);
...@@ -5200,8 +5207,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) ...@@ -5200,8 +5207,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
else else
bottom_margin = PT + 1; bottom_margin = PT + 1;
if (bottom_margin > opoint) if (bottom_margin > marker_position (opoint_marker))
SET_PT_BOTH (opoint, opoint_byte); SET_PT_BOTH (marker_position (opoint_marker),
marker_byte_position (opoint_marker));
else else
{ {
if (!NILP (Vscroll_preserve_screen_position)) if (!NILP (Vscroll_preserve_screen_position))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment