diff options
| author | Miles Bader | 2000-08-01 12:56:24 +0000 |
|---|---|---|
| committer | Miles Bader | 2000-08-01 12:56:24 +0000 |
| commit | 10b0f752ea173626d4e8e5cd109cdfbd98cab0fe (patch) | |
| tree | e7725f83e8604d5c45304212ff6d4a15be3f6714 | |
| parent | 032ebb2999b331a8150f333592ad5777e9054df4 (diff) | |
| download | emacs-10b0f752ea173626d4e8e5cd109cdfbd98cab0fe.tar.gz emacs-10b0f752ea173626d4e8e5cd109cdfbd98cab0fe.zip | |
(Fconstrain_to_field): Fix the conditions for deciding when to constrain
NEW_POS (they were pretty screwed up before).
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/editfns.c | 31 |
2 files changed, 22 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f2f62365838..5efe0edb18b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2000-08-01 Miles Bader <miles@gnu.org> | ||
| 2 | |||
| 3 | * editfns.c (Fconstrain_to_field): Fix the conditions for deciding | ||
| 4 | when to constrain NEW_POS (they were pretty screwed up before). | ||
| 5 | |||
| 1 | 2000-07-31 Eli Zaretskii <eliz@is.elta.co.il> | 6 | 2000-07-31 Eli Zaretskii <eliz@is.elta.co.il> |
| 2 | 7 | ||
| 3 | * msdos.c (run_msdos_command): Save and restore the master | 8 | * msdos.c (run_msdos_command): Save and restore the master |
diff --git a/src/editfns.c b/src/editfns.c index 10a52ca2ee6..d469a9908d9 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -593,20 +593,23 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil.") | |||
| 593 | else | 593 | else |
| 594 | field_bound = Ffield_beginning (old_pos, escape_from_edge); | 594 | field_bound = Ffield_beginning (old_pos, escape_from_edge); |
| 595 | 595 | ||
| 596 | if (/* If ONLY_IN_LINE is non-nil, we only constrain NEW_POS if doing | 596 | if (/* See if ESCAPE_FROM_EDGE caused FIELD_BOUND to jump to the |
| 597 | so would remain within the same line. */ | 597 | other side of NEW_POS, which would mean that NEW_POS is |
| 598 | NILP (only_in_line) | 598 | already acceptable, and it's not necessary to constrain it |
| 599 | /* In that case, see if ESCAPE_FROM_EDGE caused FIELD_BOUND | 599 | to FIELD_BOUND. */ |
| 600 | to jump to the other side of NEW_POS, which would mean | 600 | ((XFASTINT (field_bound) < XFASTINT (new_pos)) ? fwd : !fwd) |
| 601 | that NEW_POS is already acceptable, and that we don't | 601 | /* NEW_POS should be constrained, but only if either |
| 602 | have to do the line-check. */ | 602 | ONLY_IN_LINE is nil (in which case any constraint is OK), |
| 603 | || ((XFASTINT (field_bound) < XFASTINT (new_pos)) ? !fwd : fwd) | 603 | or NEW_POS and FIELD_BOUND are on the same line (in which |
| 604 | /* If not, see if there's no newline intervening between | 604 | case the constraint is OK even if ONLY_IN_LINE is non-nil). */ |
| 605 | NEW_POS and FIELD_BOUND. */ | 605 | && (NILP (only_in_line) |
| 606 | || (scan_buffer ('\n', | 606 | /* This is the ONLY_IN_LINE case, check that NEW_POS and |
| 607 | XFASTINT (new_pos), XFASTINT (field_bound), | 607 | FIELD_BOUND are on the same line by seeing whether |
| 608 | fwd ? -1 : 1, &shortage, 1), | 608 | there's an intervening newline or not. */ |
| 609 | shortage != 0)) | 609 | || (scan_buffer ('\n', |
| 610 | XFASTINT (new_pos), XFASTINT (field_bound), | ||
| 611 | fwd ? -1 : 1, &shortage, 1), | ||
| 612 | shortage != 0))) | ||
| 610 | /* Constrain NEW_POS to FIELD_BOUND. */ | 613 | /* Constrain NEW_POS to FIELD_BOUND. */ |
| 611 | new_pos = field_bound; | 614 | new_pos = field_bound; |
| 612 | 615 | ||