1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

(adjust_point_for_property): Handle `display' prop on overlays.

Also handle `invisible' prop.
This commit is contained in:
Stefan Monnier 2002-11-03 09:00:47 +00:00
parent 5f1fbf6b35
commit 7e16ef60e4
2 changed files with 51 additions and 21 deletions

View File

@ -1,3 +1,13 @@
2002-11-03 Stefan Monnier <monnier@cs.yale.edu>
* keyboard.c (adjust_point_for_property): Handle `display' prop on
overlays. Also handle `invisible' prop.
2002-11-02 Stefan Monnier <monnier@cs.yale.edu>
* coding.c (decode_coding_emacs_mule, decode_coding_iso2022)
(decode_coding_sjis_big5, decode_eol): Allow lone \r in DOS EOL.
2002-11-01 Andreas Schwab <schwab@suse.de>
* editfns.c (Fmessage): Revert last change to properly handle %%

View File

@ -1785,47 +1785,67 @@ extern Lisp_Object Qcomposition, Qdisplay;
/* Adjust point to a boundary of a region that has such a property
that should be treated intangible. For the moment, we check
`composition' and `display' property. LAST_PT is the last position
of point. */
`composition', `display' and `invisible' properties.
LAST_PT is the last position of point. */
static void
adjust_point_for_property (last_pt)
int last_pt;
{
int start, end;
Lisp_Object val;
int check_composition = 1, check_display = 1;
int beg, end;
Lisp_Object val, overlay, tmp;
int check_composition = 1, check_display = 1, check_invisible = 1;
while (check_composition || check_display)
while (check_composition || check_display || check_invisible)
{
if (check_composition
&& PT > BEGV && PT < ZV
&& get_property_and_range (PT, Qcomposition, &val, &start, &end, Qnil)
&& COMPOSITION_VALID_P (start, end, val)
&& start < PT && end > PT
&& (last_pt <= start || last_pt >= end))
&& get_property_and_range (PT, Qcomposition, &val, &beg, &end, Qnil)
&& COMPOSITION_VALID_P (beg, end, val)
&& beg < PT /* && end > PT <- It's always the case. */
&& (last_pt <= beg || last_pt >= end))
{
if (PT < last_pt)
SET_PT (start);
else
SET_PT (end);
SET_PT (PT < last_pt ? beg : end);
check_display = 1;
check_invisible = 1;
}
check_composition = 0;
if (check_display
&& PT > BEGV && PT < ZV
&& get_property_and_range (PT, Qdisplay, &val, &start, &end, Qnil)
&& !NILP (val = get_char_property_and_overlay
(make_number (PT), Qdisplay, Qnil, &overlay))
&& display_prop_intangible_p (val)
&& start < PT && end > PT
&& (last_pt <= start || last_pt >= end))
&& (!OVERLAYP (overlay)
? get_property_and_range (PT, Qdisplay, &val, &beg, &end, Qnil)
: (beg = OVERLAY_POSITION (OVERLAY_START (overlay)),
end = OVERLAY_POSITION (OVERLAY_END (overlay))))
&& beg < PT /* && end > PT <- It's always the case. */
&& (last_pt <= beg || last_pt >= end))
{
if (PT < last_pt)
SET_PT (start);
else
SET_PT (end);
SET_PT (PT < last_pt ? beg : end);
check_composition = 1;
check_invisible = 1;
}
check_display = 0;
if (check_invisible
&& PT > BEGV && PT < ZV
&& !NILP (val = get_char_property_and_overlay
(make_number (PT), Qinvisible, Qnil, &overlay))
&& TEXT_PROP_MEANS_INVISIBLE (val)
&& (tmp = Fprevious_single_char_property_change
(make_number (PT + 1), Qinvisible, Qnil, Qnil),
beg = NILP (tmp) ? BEGV : XFASTINT (tmp),
beg < PT)
&& (tmp = Fnext_single_char_property_change
(make_number (PT), Qinvisible, Qnil, Qnil),
end = NILP (tmp) ? BEGV : XFASTINT (tmp),
(last_pt <= beg || last_pt >= end)))
{
SET_PT (PT < last_pt ? beg : end);
check_composition = 1;
check_display = 1;
}
check_invisible = 0;
}
}