emacs-devel
[Top][All Lists]
Advanced

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

Re: C-n and fields


From: Chong Yidong
Subject: Re: C-n and fields
Date: Sat, 16 Sep 2006 10:59:09 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Richard Stallman <address@hidden> writes:

> It's now clear what the behavior of C-n with fields needs to be.
> It should keep the column number as close as possible to the desired one
> but without moving across field boundaries.
>
> Can someone please implement that, then ack?

The behavior was broken by my 2006-08-03 change to
line-move-to-column, which in retrospect is completely misguided.
I've now reverted it.

The change was originally aimed at a line-motion bug reported on
emacs-pretest-bug on 18 July ("C-n doesn't work in Customize Option
buffer in -nw with long value displayed").  The way to trigger this
bug was supplied by Johan BockgÃrd:

    (insert (propertize "x" 'field t)
            (make-string 89 ?y)
            "\n")

    Put point on the x (or the first y) and press C-n. Point doesn't
    move.

I now think the problem lies, not in line-move-to-column, but in
line-end-position.  After computing the line end position,
line-end-position calls constrain-to-field with a nil ESCAPE-FROM-EDGE
argument.  Thus, if point lies right at the edge of the field,

            X|YYYYY
 non-nil     ^        null   
 `field'    point     `field'
 property             property

Then line-end-position reports the field end position, and similarly
end-of-line won't move point.  This is counter-intuitive.

How bout making line-end-position pass a non-nil ESCAPE-FROM-EDGE
argument?  (This indeed fixes the bug in the test case.)

*** emacs/src/editfns.c.~1.428.~        2006-09-12 23:04:03.000000000 -0400
--- emacs/src/editfns.c 2006-09-16 10:42:43.000000000 -0400
***************
*** 874,880 ****
  
    /* Return END_POS constrained to the current input field.  */
    return Fconstrain_to_field (make_number (end_pos), make_number (orig),
!                             Qnil, Qt, Qnil);
  }
  

--- 874,880 ----
  
    /* Return END_POS constrained to the current input field.  */
    return Fconstrain_to_field (make_number (end_pos), make_number (orig),
!                             Qt, Qt, Qnil);
  }
  





reply via email to

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