Commit 10b0f752 authored by Miles Bader's avatar Miles Bader
Browse files

(Fconstrain_to_field): Fix the conditions for deciding when to constrain

  NEW_POS (they were pretty screwed up before).
parent 032ebb29
2000-08-01 Miles Bader <miles@gnu.org>
* editfns.c (Fconstrain_to_field): Fix the conditions for deciding
when to constrain NEW_POS (they were pretty screwed up before).
2000-07-31 Eli Zaretskii <eliz@is.elta.co.il> 2000-07-31 Eli Zaretskii <eliz@is.elta.co.il>
   
* msdos.c (run_msdos_command): Save and restore the master * msdos.c (run_msdos_command): Save and restore the master
......
...@@ -593,20 +593,23 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil.") ...@@ -593,20 +593,23 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil.")
else else
field_bound = Ffield_beginning (old_pos, escape_from_edge); field_bound = Ffield_beginning (old_pos, escape_from_edge);
if (/* If ONLY_IN_LINE is non-nil, we only constrain NEW_POS if doing if (/* See if ESCAPE_FROM_EDGE caused FIELD_BOUND to jump to the
so would remain within the same line. */ other side of NEW_POS, which would mean that NEW_POS is
NILP (only_in_line) already acceptable, and it's not necessary to constrain it
/* In that case, see if ESCAPE_FROM_EDGE caused FIELD_BOUND to FIELD_BOUND. */
to jump to the other side of NEW_POS, which would mean ((XFASTINT (field_bound) < XFASTINT (new_pos)) ? fwd : !fwd)
that NEW_POS is already acceptable, and that we don't /* NEW_POS should be constrained, but only if either
have to do the line-check. */ ONLY_IN_LINE is nil (in which case any constraint is OK),
|| ((XFASTINT (field_bound) < XFASTINT (new_pos)) ? !fwd : fwd) or NEW_POS and FIELD_BOUND are on the same line (in which
/* If not, see if there's no newline intervening between case the constraint is OK even if ONLY_IN_LINE is non-nil). */
NEW_POS and FIELD_BOUND. */ && (NILP (only_in_line)
|| (scan_buffer ('\n', /* This is the ONLY_IN_LINE case, check that NEW_POS and
XFASTINT (new_pos), XFASTINT (field_bound), FIELD_BOUND are on the same line by seeing whether
fwd ? -1 : 1, &shortage, 1), there's an intervening newline or not. */
shortage != 0)) || (scan_buffer ('\n',
XFASTINT (new_pos), XFASTINT (field_bound),
fwd ? -1 : 1, &shortage, 1),
shortage != 0)))
/* Constrain NEW_POS to FIELD_BOUND. */ /* Constrain NEW_POS to FIELD_BOUND. */
new_pos = field_bound; new_pos = field_bound;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment