Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
580fae94
Commit
580fae94
authored
Dec 15, 1996
by
Richard M. Stallman
Browse files
(set_point): Check for intangible properties on overlays.
parent
fcab51aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
42 deletions
+55
-42
src/intervals.c
src/intervals.c
+55
-42
No files found.
src/intervals.c
View file @
580fae94
...
@@ -1588,8 +1588,10 @@ set_point (position, buffer)
...
@@ -1588,8 +1588,10 @@ set_point (position, buffer)
register INTERVAL to, from, toprev, fromprev, target;
register INTERVAL to, from, toprev, fromprev, target;
int buffer_point;
int buffer_point;
register Lisp_Object obj;
register Lisp_Object obj;
int backwards = (position < BUF_PT (buffer)) ? 1 : 0;
int old_position = BUF_PT (buffer);
int old_position = BUF_PT (buffer);
int backwards = (position < old_position ? 1 : 0);
int have_overlays;
int original_position;
buffer->point_before_scroll = Qnil;
buffer->point_before_scroll = Qnil;
...
@@ -1602,9 +1604,13 @@ set_point (position, buffer)
...
@@ -1602,9 +1604,13 @@ set_point (position, buffer)
if (position > BUF_Z (buffer) || position < BUF_BEG (buffer))
if (position > BUF_Z (buffer) || position < BUF_BEG (buffer))
abort ();
abort ();
if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)))
have_overlays = (! NILP (buffer->overlays_before)
|| ! NILP (buffer->overlays_after));
/* If we have no text properties and overlays,
then we can do it quickly. */
if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) && ! have_overlays)
{
{
BUF_PT (buffer) = position;
BUF_PT (buffer) = position;
return;
return;
}
}
...
@@ -1615,7 +1621,7 @@ set_point (position, buffer)
...
@@ -1615,7 +1621,7 @@ set_point (position, buffer)
to = find_interval (BUF_INTERVALS (buffer), position);
to = find_interval (BUF_INTERVALS (buffer), position);
if (position == BUF_BEGV (buffer))
if (position == BUF_BEGV (buffer))
toprev = 0;
toprev = 0;
else if (to->position == position)
else if (to
&& to
->position == position)
toprev = previous_interval (to);
toprev = previous_interval (to);
else
else
toprev = to;
toprev = to;
...
@@ -1631,7 +1637,7 @@ set_point (position, buffer)
...
@@ -1631,7 +1637,7 @@ set_point (position, buffer)
from = find_interval (BUF_INTERVALS (buffer), buffer_point);
from = find_interval (BUF_INTERVALS (buffer), buffer_point);
if (buffer_point == BUF_BEGV (buffer))
if (buffer_point == BUF_BEGV (buffer))
fromprev = 0;
fromprev = 0;
else if (from->position == BUF_PT (buffer))
else if (from
&& from
->position == BUF_PT (buffer))
fromprev = previous_interval (from);
fromprev = previous_interval (from);
else if (buffer_point != BUF_PT (buffer))
else if (buffer_point != BUF_PT (buffer))
fromprev = from, from = 0;
fromprev = from, from = 0;
...
@@ -1639,64 +1645,71 @@ set_point (position, buffer)
...
@@ -1639,64 +1645,71 @@ set_point (position, buffer)
fromprev = from;
fromprev = from;
/* Moving within an interval. */
/* Moving within an interval. */
if (to == from && toprev == fromprev && INTERVAL_VISIBLE_P (to))
if (to == from && toprev == fromprev && INTERVAL_VISIBLE_P (to)
&& ! have_overlays)
{
{
BUF_PT (buffer) = position;
BUF_PT (buffer) = position;
return;
return;
}
}
original_position = position;
/* If the new position is between two intangible characters
/* If the new position is between two intangible characters
with the same intangible property value,
with the same intangible property value,
move forward or backward until a change in that property. */
move forward or backward until a change in that property. */
if (NILP (Vinhibit_point_motion_hooks) && ! NULL_INTERVAL_P (to)
if (NILP (Vinhibit_point_motion_hooks)
&& ! NULL_INTERVAL_P (toprev))
&& ((! NULL_INTERVAL_P (to) && ! NULL_INTERVAL_P (toprev))
|| have_overlays))
{
{
Lisp_Object intangible_propval;
Lisp_Object pos;
XSETINT (pos, position);
if (backwards)
if (backwards)
{
{
Lisp_Object
intangible_propval
;
intangible_propval
= Fget_char_property (make_number (position),
intangible
_propval = textget (to->plist, Qintangible
);
Q
intangible
, Qnil
);
/* If following char is intangible,
/* If following char is intangible,
skip back over all chars with matching intangible property. */
skip back over all chars with matching intangible property. */
if (! NILP (intangible_propval))
if (! NILP (intangible_propval))
while (to == toprev
while (XINT (pos) > BUF_BEGV (buffer)
|| ((! NULL_INTERVAL_P (toprev)
&& EQ (Fget_char_property (make_number (XINT (pos) - 1),
&& EQ (textget (toprev->plist, Qintangible),
Qintangible, Qnil),
intangible_propval))))
intangible_propval))
{
pos = Fprevious_char_property_change (pos, Qnil);
to = toprev;
toprev = previous_interval (toprev);
if (NULL_INTERVAL_P (toprev))
position = BUF_BEGV (buffer);
else
/* This is the only line that's not
dual to the following loop.
That's because we want the position
at the end of TOPREV. */
position = to->position;
}
}
}
else
else
{
{
Lisp_Object
intangible_propval
;
intangible_propval
= Fget_char_property (make_number (position - 1),
intangible
_propval = textget (toprev->plist, Qintangible
);
Q
intangible
, Qnil
);
/* If
previous
char is intangible,
/* If
following
char is intangible,
skip
fwd
over all chars with matching intangible property. */
skip
back
over all chars with matching intangible property. */
if (! NILP (intangible_propval))
if (! NILP (intangible_propval))
while (to == toprev
while (XINT (pos) < BUF_ZV (buffer)
|| ((! NULL_INTERVAL_P (to)
&& EQ (Fget_char_property (pos, Qintangible, Qnil),
&& EQ (textget (to->plist, Qintangible),
intangible_propval))
intangible_propval))))
pos = Fnext_char_property_change (pos, Qnil);
{
toprev = to;
to = next_interval (to);
if (NULL_INTERVAL_P (to))
position = BUF_ZV (buffer);
else
position = to->position;
}
}
}
position = XINT (pos);
}
if (position != original_position)
{
/* Set TO to the interval containing the char after POSITION,
and TOPREV to the interval containing the char before POSITION.
Either one may be null. They may be equal. */
to = find_interval (BUF_INTERVALS (buffer), position);
if (position == BUF_BEGV (buffer))
toprev = 0;
else if (to && to->position == position)
toprev = previous_interval (to);
else
toprev = to;
}
}
/* Here TO is the interval after the stopping point
/* Here TO is the interval after the stopping point
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment