emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: next-line skips some lines


From: Kim F. Storm
Subject: Re: next-line skips some lines
Date: Tue, 16 Nov 2004 14:57:39 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

Henrik Enberg <address@hidden> writes:

> If I open the attached file and hit C-n, point will jump over the second
> line and end up on the third line.  You need to obey the local variables
> to see the bug.

> Local Variables:
> truncate-lines: t
> End:


This is caused by this change to Fvertical_motion:

2004-11-13  Richard M. Stallman  <address@hidden>

        * indent.c (Fvertical_motion): Scan to PT from start of line to
        make iterator consistent.

Below is the relevant diff.

This fails when truncate-lines is on, because point is at the end of
the truncated line on entry to Fvertical_motion, so it is beyond the
right margin.  In this case, the move_it_to will exit by reseating to
the start of the next visible line (so it.vpos == 1 on return).

But I don't understand why this change is needed at all??

It obviously doesn't work for truncate-lines non-nil, and AFAICS,
start_display already does the reseat_at_previous_visible_line_start
stuff when truncate-lines is nil.

In what case was the iterator "inconsistent" before the change?


Index: indent.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/indent.c,v
retrieving revision 1.165
retrieving revision 1.166
diff -c -r1.165 -r1.166
*** indent.c    27 Oct 2004 10:57:40 -0000      1.165
--- indent.c    14 Nov 2004 04:13:54 -0000      1.166
***************
*** 2064,2076 ****
    SET_TEXT_POS (pt, PT, PT_BYTE);
    start_display (&it, w, pt);
  
!   /* Move to the start of the display line containing PT.  If we don't
       do this, we start moving with IT->current_x == 0, while PT is
       really at some x > 0.  The effect is, in continuation lines, that
       we end up with the iterator placed at where it thinks X is 0,
       while the end position is really at some X > 0, the same X that
       PT had.  */
!   move_it_by_lines (&it, 0, 0);
  
    if (XINT (lines) != 0)
      move_it_by_lines (&it, XINT (lines), 0);
--- 2064,2079 ----
    SET_TEXT_POS (pt, PT, PT_BYTE);
    start_display (&it, w, pt);
  
!   /* Scan from the start of the line containing PT.  If we don't
       do this, we start moving with IT->current_x == 0, while PT is
       really at some x > 0.  The effect is, in continuation lines, that
       we end up with the iterator placed at where it thinks X is 0,
       while the end position is really at some X > 0, the same X that
       PT had.  */
!   reseat_at_previous_visible_line_start (&it);
!   it.current_x = it.hpos = 0;
!   move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
!   it.vpos = 0;
  
    if (XINT (lines) != 0)
      move_it_by_lines (&it, XINT (lines), 0);

-- 
Kim F. Storm  http://www.cua.dk





reply via email to

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