Mercurial > emacs
diff src/editfns.c @ 90288:7432ca837c8d
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-9
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 16-33)
- Update from CVS
- Install ERC.
- Fix ERC compiler warnings.
- Use utf-8 encoding in ERC ChangeLogs.
- Merge ERC-related Viper hacks into Viper.
- Merge from erc--main--0
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 8-13)
- Merge from emacs--devo--0
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 01 Feb 2006 10:07:17 +0000 |
parents | 7beb78bc1f8e 0b6d0aad4517 |
children | c5406394f567 |
line wrap: on
line diff
--- a/src/editfns.c Thu Jan 26 02:23:05 2006 +0000 +++ b/src/editfns.c Wed Feb 01 10:07:17 2006 +0000 @@ -524,7 +524,9 @@ = (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 @@ -715,7 +717,8 @@ { /* 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. */ { @@ -723,23 +726,40 @@ 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 (Fget_char_property (new_pos, Qfield, Qnil)) - || !NILP (Fget_char_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 (Fget_char_property(old_pos, inhibit_capture_property, Qnil)))) - /* NEW_POS is not within the same field as OLD_POS; try to - move NEW_POS so that it is. */ + /* 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 @@ -780,9 +800,10 @@ With argument N not nil or 1, move forward N - 1 lines first. If scan reaches end of buffer, return that position. -The scan does not cross a field boundary unless doing so would move -beyond there to a different line; if N is nil or 1, and scan starts at a -field boundary, the scan stops as soon as it starts. To ignore field +This function constrains the returned position to the current field +unless that would be on a different line than the original, +unconstrained result. If N is nil or 1, and a front-sticky field +starts at point, the scan stops as soon as it starts. To ignore field boundaries bind `inhibit-field-text-motion' to t. This function does not move point. */) @@ -814,9 +835,10 @@ With argument N not nil or 1, move forward N - 1 lines first. If scan reaches end of buffer, return that position. -The scan does not cross a field boundary unless doing so would move -beyond there to a different line; if N is nil or 1, and scan starts at a -field boundary, the scan stops as soon as it starts. To ignore field +This function constrains the returned position to the current field +unless that would be on a different line than the original, +unconstrained result. If N is nil or 1, and a rear-sticky field ends +at point, the scan stops as soon as it starts. To ignore field boundaries bind `inhibit-field-text-motion' to t. This function does not move point. */)