summaryrefslogtreecommitdiff
path: root/src/intervals.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-04-09 09:42:28 +0000
committerRichard M. Stallman <rms@gnu.org>1995-04-09 09:42:28 +0000
commit8cd048e22b6bab941606a60ab42a72c77dec2a98 (patch)
tree693030ffa2621e0ac9efac9066415e1553b9d364 /src/intervals.c
parentd4edeee467b715310abd6893d896aa7a2e45925b (diff)
downloademacs-8cd048e22b6bab941606a60ab42a72c77dec2a98.tar.gz
(set_point): When skipping intangible text,
stop where property value changes.
Diffstat (limited to 'src/intervals.c')
-rw-r--r--src/intervals.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/src/intervals.c b/src/intervals.c
index 80b7333491c..26fcfd9e701 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1644,20 +1644,24 @@ set_point (position, buffer)
return;
}
- /* If the new position is between two intangible characters,
- move forward or backward across all such characters. */
+ /* If the new position is between two intangible characters
+ with the same intangible property value,
+ move forward or backward until a change in that property. */
if (NILP (Vinhibit_point_motion_hooks) && ! NULL_INTERVAL_P (to)
&& ! NULL_INTERVAL_P (toprev))
{
if (backwards)
{
- /* Make sure the following character is intangible
- if the previous one is. */
- if (toprev == to
- || ! NILP (textget (to->plist, Qintangible)))
- /* Ok, that is so. Back up across intangible text. */
- while (! NULL_INTERVAL_P (toprev)
- && ! NILP (textget (toprev->plist, Qintangible)))
+ Lisp_Object intangible_propval;
+ intangible_propval = textget (to->plist, Qintangible);
+
+ /* If following char is intangible,
+ skip back over all chars with matching intangible property. */
+ if (! NILP (intangible_propval))
+ while (to == toprev
+ || ((! NULL_INTERVAL_P (toprev)
+ && EQ (textget (toprev->plist, Qintangible),
+ intangible_propval))))
{
to = toprev;
toprev = previous_interval (toprev);
@@ -1673,13 +1677,16 @@ set_point (position, buffer)
}
else
{
- /* Make sure the previous character is intangible
- if the following one is. */
- if (toprev == to
- || ! NILP (textget (toprev->plist, Qintangible)))
- /* Ok, that is so. Advance across intangible text. */
- while (! NULL_INTERVAL_P (to)
- && ! NILP (textget (to->plist, Qintangible)))
+ Lisp_Object intangible_propval;
+ intangible_propval = textget (toprev->plist, Qintangible);
+
+ /* If previous char is intangible,
+ skip fwd over all chars with matching intangible property. */
+ if (! NILP (intangible_propval))
+ while (to == toprev
+ || ((! NULL_INTERVAL_P (to)
+ && EQ (textget (to->plist, Qintangible),
+ intangible_propval))))
{
toprev = to;
to = next_interval (to);
@@ -1689,11 +1696,12 @@ set_point (position, buffer)
position = to->position;
}
}
- /* Here TO is the interval after the stopping point
- and TOPREV is the interval before the stopping point.
- One or the other may be null. */
}
+ /* Here TO is the interval after the stopping point
+ and TOPREV is the interval before the stopping point.
+ One or the other may be null. */
+
BUF_PT (buffer) = position;
/* We run point-left and point-entered hooks here, iff the