unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: emacs-devel@gnu.org
Subject: Re: [az@ftc.ru: hl-line-mode conflicts with scroll-margin]
Date: 15 Jun 2004 00:40:03 +0200	[thread overview]
Message-ID: <m3brjl227w.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <87fz8yt4tb.fsf@mail.jurta.org>

Juri Linkov <juri@jurta.org> writes:

> storm@cua.dk (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 <storm@cua.dk> http://www.cua.dk

  reply	other threads:[~2004-06-14 22:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-13  0:01 [az@ftc.ru: hl-line-mode conflicts with scroll-margin] Richard Stallman
2004-06-14 12:13 ` Kim F. Storm
2004-06-14 17:41   ` Juri Linkov
2004-06-14 22:40     ` Kim F. Storm [this message]
2004-06-15 10:42       ` Kim F. Storm
2004-06-15 11:11         ` Juri Linkov
2004-06-15 10:40   ` Kim F. Storm
  -- strict thread matches above, loose matches on Subject: below --
2004-06-05 13:48 Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3brjl227w.fsf@kfs-l.imdomain.dk \
    --to=storm@cua.dk \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).