comparison src/intervals.c @ 11327:76908dad81a4

(set_point): When skipping intangible text, stop where property value changes.
author Richard M. Stallman <rms@gnu.org>
date Sun, 09 Apr 1995 09:42:28 +0000
parents e6bdaaa6ce1b
children 7c7519c2a45a
comparison
equal deleted inserted replaced
11326:0d5ebc078c51 11327:76908dad81a4
1642 { 1642 {
1643 BUF_PT (buffer) = position; 1643 BUF_PT (buffer) = position;
1644 return; 1644 return;
1645 } 1645 }
1646 1646
1647 /* If the new position is between two intangible characters, 1647 /* If the new position is between two intangible characters
1648 move forward or backward across all such characters. */ 1648 with the same intangible property value,
1649 move forward or backward until a change in that property. */
1649 if (NILP (Vinhibit_point_motion_hooks) && ! NULL_INTERVAL_P (to) 1650 if (NILP (Vinhibit_point_motion_hooks) && ! NULL_INTERVAL_P (to)
1650 && ! NULL_INTERVAL_P (toprev)) 1651 && ! NULL_INTERVAL_P (toprev))
1651 { 1652 {
1652 if (backwards) 1653 if (backwards)
1653 { 1654 {
1654 /* Make sure the following character is intangible 1655 Lisp_Object intangible_propval;
1655 if the previous one is. */ 1656 intangible_propval = textget (to->plist, Qintangible);
1656 if (toprev == to 1657
1657 || ! NILP (textget (to->plist, Qintangible))) 1658 /* If following char is intangible,
1658 /* Ok, that is so. Back up across intangible text. */ 1659 skip back over all chars with matching intangible property. */
1659 while (! NULL_INTERVAL_P (toprev) 1660 if (! NILP (intangible_propval))
1660 && ! NILP (textget (toprev->plist, Qintangible))) 1661 while (to == toprev
1662 || ((! NULL_INTERVAL_P (toprev)
1663 && EQ (textget (toprev->plist, Qintangible),
1664 intangible_propval))))
1661 { 1665 {
1662 to = toprev; 1666 to = toprev;
1663 toprev = previous_interval (toprev); 1667 toprev = previous_interval (toprev);
1664 if (NULL_INTERVAL_P (toprev)) 1668 if (NULL_INTERVAL_P (toprev))
1665 position = BUF_BEGV (buffer); 1669 position = BUF_BEGV (buffer);
1671 position = to->position; 1675 position = to->position;
1672 } 1676 }
1673 } 1677 }
1674 else 1678 else
1675 { 1679 {
1676 /* Make sure the previous character is intangible 1680 Lisp_Object intangible_propval;
1677 if the following one is. */ 1681 intangible_propval = textget (toprev->plist, Qintangible);
1678 if (toprev == to 1682
1679 || ! NILP (textget (toprev->plist, Qintangible))) 1683 /* If previous char is intangible,
1680 /* Ok, that is so. Advance across intangible text. */ 1684 skip fwd over all chars with matching intangible property. */
1681 while (! NULL_INTERVAL_P (to) 1685 if (! NILP (intangible_propval))
1682 && ! NILP (textget (to->plist, Qintangible))) 1686 while (to == toprev
1687 || ((! NULL_INTERVAL_P (to)
1688 && EQ (textget (to->plist, Qintangible),
1689 intangible_propval))))
1683 { 1690 {
1684 toprev = to; 1691 toprev = to;
1685 to = next_interval (to); 1692 to = next_interval (to);
1686 if (NULL_INTERVAL_P (to)) 1693 if (NULL_INTERVAL_P (to))
1687 position = BUF_ZV (buffer); 1694 position = BUF_ZV (buffer);
1688 else 1695 else
1689 position = to->position; 1696 position = to->position;
1690 } 1697 }
1691 } 1698 }
1692 /* Here TO is the interval after the stopping point 1699 }
1693 and TOPREV is the interval before the stopping point. 1700
1694 One or the other may be null. */ 1701 /* Here TO is the interval after the stopping point
1695 } 1702 and TOPREV is the interval before the stopping point.
1703 One or the other may be null. */
1696 1704
1697 BUF_PT (buffer) = position; 1705 BUF_PT (buffer) = position;
1698 1706
1699 /* We run point-left and point-entered hooks here, iff the 1707 /* We run point-left and point-entered hooks here, iff the
1700 two intervals are not equivalent. These hooks take 1708 two intervals are not equivalent. These hooks take