unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David PONCE <david.ponce@wanadoo.fr>
Subject: Perhaps a bug in line-move-1
Date: Fri, 24 Jun 2005 16:29:28 +0200 (CEST)	[thread overview]
Message-ID: <28128467.1119623368523.JavaMail.www@wwinf1518> (raw)

Hello,

Since this change to line-move-1 in simple.el:

2005-06-23  Richard M. Stallman  <rms@gnu.org>

	* simple.el (set-variable): Args renamed; doc fix.
	(line-move-1): When there are overlays around, use
	vertical-motion.


When I use the up/down button to move the cursor to the previous/next
line, it actually move it up/down 2 lines.  I looked at the
implementation and it seems that when there are overlays around the
text moved over (which is the case in buffers where semantic is
enabled), the code unconditionally calls forward-line, then
`vertical-motion', which looks like a bug.

The following patch seems to have fixed the problem.

Hope it will help.
Sincerely,
David

Index: simple.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
retrieving revision 1.733
diff -c -r1.733 simple.el
*** simple.el	23 Jun 2005 21:26:31 -0000	1.733
--- simple.el	24 Jun 2005 14:11:36 -0000
***************
*** 3442,3455 ****
  		  (when (and (not done)
  			     (not (integerp selective-display))
  			     (not (line-move-invisible-p (point))))
- 		    ;; We avoid vertical-motion when possible
- 		    ;; because that has to fontify.
- 		    (forward-line 1)
  		    ;; If there are overlays in and around
  		    ;; the text we moved over, we need to be
  		    ;; sophisticated.
  		    (unless (overlays-in (max (1- pos-before) (point-min))
  					 (min (1+ (point)) (point-max)))
  		      (setq line-done t)))
  		  ;; Otherwise move a more sophisticated way.
  		  ;; (What's the logic behind this code?)
--- 3442,3455 ----
  		  (when (and (not done)
  			     (not (integerp selective-display))
  			     (not (line-move-invisible-p (point))))
  		    ;; If there are overlays in and around
  		    ;; the text we moved over, we need to be
  		    ;; sophisticated.
  		    (unless (overlays-in (max (1- pos-before) (point-min))
  					 (min (1+ (point)) (point-max)))
+ 		      ;; We avoid vertical-motion when possible
+ 		      ;; because that has to fontify.
+ 		      (forward-line 1)
  		      (setq line-done t)))
  		  ;; Otherwise move a more sophisticated way.
  		  ;; (What's the logic behind this code?)
***************
*** 3473,3481 ****
  		  (when (and (not done)
  			     (not (integerp selective-display))
  			     (not (line-move-invisible-p (1- (point)))))
- 		    (forward-line -1)
  		    (unless (overlays-in (max (1- (point)) (point-min))
  					 (min (1+ pos-before) (point-max)))
  		      (setq line-done t)))
  		  (and (not done) (not line-done)
  		       (zerop (vertical-motion -1))
--- 3473,3481 ----
  		  (when (and (not done)
  			     (not (integerp selective-display))
  			     (not (line-move-invisible-p (1- (point)))))
  		    (unless (overlays-in (max (1- (point)) (point-min))
  					 (min (1+ pos-before) (point-max)))
+ 		      (forward-line -1)
  		      (setq line-done t)))
  		  (and (not done) (not line-done)
  		       (zerop (vertical-motion -1))

             reply	other threads:[~2005-06-24 14:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-24 14:29 David PONCE [this message]
2005-06-25  0:31 ` Perhaps a bug in line-move-1 Richard M. 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=28128467.1119623368523.JavaMail.www@wwinf1518 \
    --to=david.ponce@wanadoo.fr \
    /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).