diff options
| author | Eli Zaretskii | 2011-04-29 21:03:00 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2011-04-29 21:03:00 +0300 |
| commit | 03ab8921a811be962c0fc0b6879fb59e08e7952c (patch) | |
| tree | 77fd111f869901106c6020f20d72f42877247ab5 /src | |
| parent | 7eabc1bec835d723ed5128441cffae163c4592f1 (diff) | |
| download | emacs-03ab8921a811be962c0fc0b6879fb59e08e7952c.tar.gz emacs-03ab8921a811be962c0fc0b6879fb59e08e7952c.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/window.c | 20 |
2 files changed, 17 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index bb660036c17..f029daa684d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2011-04-29 Eli Zaretskii <eliz@gnu.org> | 1 | 2011-04-29 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * window.c (window_scroll_line_based): Use a marker instead of | ||
| 4 | simple variables to record original value of point. (Bug#7952) | ||
| 5 | |||
| 3 | * doprnt.c (doprnt): Fix the case where a multibyte sequence | 6 | * doprnt.c (doprnt): Fix the case where a multibyte sequence |
| 4 | produced by %s or %c overflows available buffer space. (Bug#8545) | 7 | produced by %s or %c overflows available buffer space. (Bug#8545) |
| 5 | 8 | ||
diff --git a/src/window.c b/src/window.c index b56ed84bc61..4dbee41c5f4 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -5076,7 +5076,12 @@ static void | |||
| 5076 | window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | 5076 | window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) |
| 5077 | { | 5077 | { |
| 5078 | register struct window *w = XWINDOW (window); | 5078 | register struct window *w = XWINDOW (window); |
| 5079 | register EMACS_INT opoint = PT, opoint_byte = PT_BYTE; | 5079 | /* Fvertical_motion enters redisplay, which can trigger |
| 5080 | fontification, which in turn can modify buffer text (e.g., if the | ||
| 5081 | fontification functions replace escape sequences with faces, as | ||
| 5082 | in `grep-mode-font-lock-keywords'). So we use a marker to record | ||
| 5083 | the old point position, to prevent crashes in SET_PT_BOTH. */ | ||
| 5084 | Lisp_Object opoint_marker = Fpoint_marker (); | ||
| 5080 | register EMACS_INT pos, pos_byte; | 5085 | register EMACS_INT pos, pos_byte; |
| 5081 | register int ht = window_internal_height (w); | 5086 | register int ht = window_internal_height (w); |
| 5082 | register Lisp_Object tem; | 5087 | register Lisp_Object tem; |
| @@ -5126,7 +5131,8 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 5126 | pos = PT; | 5131 | pos = PT; |
| 5127 | pos_byte = PT_BYTE; | 5132 | pos_byte = PT_BYTE; |
| 5128 | bolp = Fbolp (); | 5133 | bolp = Fbolp (); |
| 5129 | SET_PT_BOTH (opoint, opoint_byte); | 5134 | SET_PT_BOTH (marker_position (opoint_marker), |
| 5135 | marker_byte_position (opoint_marker)); | ||
| 5130 | 5136 | ||
| 5131 | if (lose) | 5137 | if (lose) |
| 5132 | { | 5138 | { |
| @@ -5177,8 +5183,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 5177 | else | 5183 | else |
| 5178 | top_margin = pos; | 5184 | top_margin = pos; |
| 5179 | 5185 | ||
| 5180 | if (top_margin <= opoint) | 5186 | if (top_margin <= marker_position (opoint_marker)) |
| 5181 | SET_PT_BOTH (opoint, opoint_byte); | 5187 | SET_PT_BOTH (marker_position (opoint_marker), |
| 5188 | marker_byte_position (opoint_marker)); | ||
| 5182 | else if (!NILP (Vscroll_preserve_screen_position)) | 5189 | else if (!NILP (Vscroll_preserve_screen_position)) |
| 5183 | { | 5190 | { |
| 5184 | SET_PT_BOTH (pos, pos_byte); | 5191 | SET_PT_BOTH (pos, pos_byte); |
| @@ -5200,8 +5207,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 5200 | else | 5207 | else |
| 5201 | bottom_margin = PT + 1; | 5208 | bottom_margin = PT + 1; |
| 5202 | 5209 | ||
| 5203 | if (bottom_margin > opoint) | 5210 | if (bottom_margin > marker_position (opoint_marker)) |
| 5204 | SET_PT_BOTH (opoint, opoint_byte); | 5211 | SET_PT_BOTH (marker_position (opoint_marker), |
| 5212 | marker_byte_position (opoint_marker)); | ||
| 5205 | else | 5213 | else |
| 5206 | { | 5214 | { |
| 5207 | if (!NILP (Vscroll_preserve_screen_position)) | 5215 | if (!NILP (Vscroll_preserve_screen_position)) |