mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-18 10:57:34 +00:00
(Fconstrain_to_field): Fix behaviour on field boundaries.
(find_field): Set before_field to after_field when pos is at BEGV.
This commit is contained in:
parent
13c42cc53a
commit
e477bb0420
2 changed files with 33 additions and 13 deletions
|
|
@ -1,7 +1,7 @@
|
|||
2006-01-26 L$,1 q(Brentey K,Aa(Broly <lorentey@elte.hu>
|
||||
|
||||
* editfns.c (Fconstrain_to_field): Use get_pos_property, not
|
||||
Fget_char_property. Fix bogus comment.
|
||||
* editfns.c (Fconstrain_to_field): Fix behaviour on field boundaries.
|
||||
(find_field): Set before_field to after_field when pos is at BEGV.
|
||||
(Fline_beginning_position, Fline_end_position): Clarify
|
||||
confusing doc string.
|
||||
|
||||
|
|
|
|||
|
|
@ -526,7 +526,9 @@ find_field (pos, merge_at_boundary, beg_limit, beg, end_limit, end)
|
|||
= (XFASTINT (pos) > BEGV
|
||||
? get_char_property_and_overlay (make_number (XINT (pos) - 1),
|
||||
Qfield, Qnil, NULL)
|
||||
: Qnil);
|
||||
/* Using nil here would be a more obvious choice, but it would
|
||||
fail when the buffer starts with a non-sticky field. */
|
||||
: after_field);
|
||||
|
||||
/* See if we need to handle the case where MERGE_AT_BOUNDARY is nil
|
||||
and POS is at beginning of a field, which can also be interpreted
|
||||
|
|
@ -717,7 +719,8 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */)
|
|||
{
|
||||
/* If non-zero, then the original point, before re-positioning. */
|
||||
int orig_point = 0;
|
||||
|
||||
int fwd, prev_old, prev_new;
|
||||
|
||||
if (NILP (new_pos))
|
||||
/* Use the current point, and afterwards, set it. */
|
||||
{
|
||||
|
|
@ -725,23 +728,40 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */)
|
|||
XSETFASTINT (new_pos, PT);
|
||||
}
|
||||
|
||||
CHECK_NUMBER_COERCE_MARKER (new_pos);
|
||||
CHECK_NUMBER_COERCE_MARKER (old_pos);
|
||||
|
||||
fwd = (XFASTINT (new_pos) > XFASTINT (old_pos));
|
||||
|
||||
prev_old = make_number (XFASTINT (old_pos) - 1);
|
||||
prev_new = make_number (XFASTINT (new_pos) - 1);
|
||||
|
||||
if (NILP (Vinhibit_field_text_motion)
|
||||
&& !EQ (new_pos, old_pos)
|
||||
&& (!NILP (get_pos_property (new_pos, Qfield, Qnil))
|
||||
|| !NILP (get_pos_property (old_pos, Qfield, Qnil)))
|
||||
&& (!NILP (Fget_text_property (new_pos, Qfield, Qnil))
|
||||
|| !NILP (Fget_text_property (old_pos, Qfield, Qnil))
|
||||
/* To recognize field boundaries, we must also look at the
|
||||
previous positions; we could use `get_pos_property'
|
||||
instead, but in itself that would fail inside non-sticky
|
||||
fields (like comint prompts). */
|
||||
|| (XFASTINT (new_pos) > BEGV
|
||||
&& !NILP (Fget_text_property (prev_new, Qfield, Qnil)))
|
||||
|| (XFASTINT (old_pos) > BEGV
|
||||
&& !NILP (Fget_text_property (prev_old, Qfield, Qnil))))
|
||||
&& (NILP (inhibit_capture_property)
|
||||
|| NILP (get_pos_property (old_pos, inhibit_capture_property, Qnil))))
|
||||
/* Field boundaries are again a problem; but now we must
|
||||
decide the case exactly, so we need to call
|
||||
`get_pos_property' as well. */
|
||||
|| (NILP (get_pos_property (old_pos, inhibit_capture_property, Qnil))
|
||||
&& (XFASTINT (old_pos) <= BEGV
|
||||
|| NILP (Fget_text_property (old_pos, inhibit_capture_property, Qnil))
|
||||
|| NILP (Fget_text_property (prev_old, inhibit_capture_property, Qnil))))))
|
||||
/* It is possible that NEW_POS is not within the same field as
|
||||
OLD_POS; try to move NEW_POS so that it is. */
|
||||
{
|
||||
int fwd, shortage;
|
||||
int shortage;
|
||||
Lisp_Object field_bound;
|
||||
|
||||
CHECK_NUMBER_COERCE_MARKER (new_pos);
|
||||
CHECK_NUMBER_COERCE_MARKER (old_pos);
|
||||
|
||||
fwd = (XFASTINT (new_pos) > XFASTINT (old_pos));
|
||||
|
||||
if (fwd)
|
||||
field_bound = Ffield_end (old_pos, escape_from_edge, new_pos);
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue