emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: hl-line-mode conflicts with scroll-margin]


From: Kim F. Storm
Subject: Re: address@hidden: hl-line-mode conflicts with scroll-margin]
Date: 15 Jun 2004 00:40:03 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Juri Linkov <address@hidden> writes:

> address@hidden (Kim F. Storm) writes:
> > The following patch solves the problem.
> 
> Here is another related bug report for you :-)
> 
> If scroll-margin is not 0 and font-lock-mode is turned on, i.e.
> 
> (progn
>   (setq scroll-margin 5)
>   (global-font-lock-mode))
> 
> then after moving the cursor down until it reaches the fifth line from
> the bottom of the window the cursor is placed in the center of the window
> where it starts jumping forth and back: after 1 second it moves to the
> end of the line, and after another 1 second moves to the beginning
> of the following line.
> 
> This bug can be reproduced on GNU/Linux in Emacs versions starting
> at least from 21.3.


Ok, try this patch:

*** xdisp.c     30 May 2004 23:13:12 +0200      1.892
--- xdisp.c     15 Jun 2004 00:31:01 +0200      
***************
*** 12542,12550 ****
         position.  */
        if (pt_row)
        {
!         w->cursor.vpos -= MATRIX_ROW_VPOS (first_reusable_row,
!                                            w->current_matrix);
!         w->cursor.y -= first_reusable_row->y;
        }
  
        /* Scroll the display.  */
--- 12542,12549 ----
         position.  */
        if (pt_row)
        {
!         w->cursor.vpos -= nrows_scrolled;
!         w->cursor.y -= first_reusable_row->y - start_row->y;
        }
  
        /* Scroll the display.  */
***************
*** 12589,12594 ****
--- 12588,12616 ----
        for (row -= nrows_scrolled; row < bottom_row; ++row)
        row->enabled_p = 0;
  
+       /* Point may have moved to a different line, so we cannot assume that
+        the previous cursor position is valid; locate the correct row.  */
+       if (pt_row)
+       {
+         for (row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
+              row < bottom_row && PT >= MATRIX_ROW_END_CHARPOS (row);
+              row++)
+           {
+             w->cursor.vpos++;
+             w->cursor.y = row->y;
+           }
+         if (row < bottom_row)
+           {
+             struct glyph *glyph = row->glyphs[TEXT_AREA] + w->cursor.hpos;
+             while (glyph->charpos < PT)
+               {
+                 w->cursor.hpos++;
+                 w->cursor.x += glyph->pixel_width;
+                 glyph++;
+               }
+           }
+       }
+ 
        /* Adjust window end.  A null value of last_text_row means that
         the window end is in reused rows which in turn means that
         only its vpos can have changed.  */

-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

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