emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r104055: Fix bug #7952 with vertical


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104055: Fix bug #7952 with vertical motion in Grep buffers.
Date: Fri, 29 Apr 2011 21:03:00 +0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104055
fixes bug(s): http://debbugs.gnu.org/7952
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Fri 2011-04-29 21:03:00 +0300
message:
  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.
modified:
  src/ChangeLog
  src/window.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-04-29 11:01:11 +0000
+++ b/src/ChangeLog     2011-04-29 18:03:00 +0000
@@ -1,5 +1,8 @@
 2011-04-29  Eli Zaretskii  <address@hidden>
 
+       * 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
        produced by %s or %c overflows available buffer space.  (Bug#8545)
 

=== modified file 'src/window.c'
--- a/src/window.c      2011-04-25 19:40:22 +0000
+++ b/src/window.c      2011-04-29 18:03:00 +0000
@@ -5076,7 +5076,12 @@
 window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
 {
   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 int ht = window_internal_height (w);
   register Lisp_Object tem;
@@ -5126,7 +5131,8 @@
   pos = PT;
   pos_byte = PT_BYTE;
   bolp = Fbolp ();
-  SET_PT_BOTH (opoint, opoint_byte);
+  SET_PT_BOTH (marker_position (opoint_marker),
+              marker_byte_position (opoint_marker));
 
   if (lose)
     {
@@ -5177,8 +5183,9 @@
          else
            top_margin = pos;
 
-         if (top_margin <= opoint)
-           SET_PT_BOTH (opoint, opoint_byte);
+         if (top_margin <= marker_position (opoint_marker))
+           SET_PT_BOTH (marker_position (opoint_marker),
+                        marker_byte_position (opoint_marker));
          else if (!NILP (Vscroll_preserve_screen_position))
            {
              SET_PT_BOTH (pos, pos_byte);
@@ -5200,8 +5207,9 @@
          else
            bottom_margin = PT + 1;
 
-         if (bottom_margin > opoint)
-           SET_PT_BOTH (opoint, opoint_byte);
+         if (bottom_margin > marker_position (opoint_marker))
+           SET_PT_BOTH (marker_position (opoint_marker),
+                        marker_byte_position (opoint_marker));
          else
            {
              if (!NILP (Vscroll_preserve_screen_position))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]