Mercurial > hg > xemacs-beta
comparison src/extents.c @ 32:e04119814345 r19-15b99
Import from CVS: tag r19-15b99
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:52:56 +0200 |
parents | 4103f0995bd7 |
children | 56c54cf7c5b6 |
comparison
equal
deleted
inserted
replaced
31:b9328a10c56c | 32:e04119814345 |
---|---|
1576 /* A change to an extent occurred that will change the display, so | 1576 /* A change to an extent occurred that will change the display, so |
1577 notify redisplay. Maybe also recurse over all the extent's | 1577 notify redisplay. Maybe also recurse over all the extent's |
1578 descendants. */ | 1578 descendants. */ |
1579 | 1579 |
1580 static void | 1580 static void |
1581 extent_changed_for_redisplay (EXTENT extent, int descendants_too) | 1581 extent_changed_for_redisplay (EXTENT extent, int descendants_too, |
1582 int invisibility_change) | |
1582 { | 1583 { |
1583 Lisp_Object object; | 1584 Lisp_Object object; |
1584 Lisp_Object rest; | 1585 Lisp_Object rest; |
1585 | 1586 |
1586 /* we could easily encounter a detached extent while traversing the | 1587 /* we could easily encounter a detached extent while traversing the |
1595 { | 1596 { |
1596 /* first mark all of the extent's children. We will lose big-time | 1597 /* first mark all of the extent's children. We will lose big-time |
1597 if there are any circularities here, so we sure as hell better | 1598 if there are any circularities here, so we sure as hell better |
1598 ensure that there aren't. */ | 1599 ensure that there aren't. */ |
1599 LIST_LOOP (rest, XWEAK_LIST_LIST (children)) | 1600 LIST_LOOP (rest, XWEAK_LIST_LIST (children)) |
1600 extent_changed_for_redisplay (XEXTENT (XCAR (rest)), 1); | 1601 extent_changed_for_redisplay (XEXTENT (XCAR (rest)), 1, |
1602 invisibility_change); | |
1601 } | 1603 } |
1602 } | 1604 } |
1603 | 1605 |
1604 /* now mark the extent itself. */ | 1606 /* now mark the extent itself. */ |
1605 | 1607 |
1624 { | 1626 { |
1625 struct buffer *b; | 1627 struct buffer *b; |
1626 b = XBUFFER (object); | 1628 b = XBUFFER (object); |
1627 BUF_FACECHANGE (b)++; | 1629 BUF_FACECHANGE (b)++; |
1628 MARK_EXTENTS_CHANGED; | 1630 MARK_EXTENTS_CHANGED; |
1631 if (invisibility_change) | |
1632 MARK_CLIP_CHANGED; | |
1629 buffer_extent_signal_changed_region (b, | 1633 buffer_extent_signal_changed_region (b, |
1630 extent_endpoint_bufpos (extent, 0), | 1634 extent_endpoint_bufpos (extent, 0), |
1631 extent_endpoint_bufpos (extent, 1)); | 1635 extent_endpoint_bufpos (extent, 1)); |
1632 } | 1636 } |
1633 } | 1637 } |
1636 This is called when properties such as the endpoints, the layout, | 1640 This is called when properties such as the endpoints, the layout, |
1637 or the priority changes. Redisplay will be affected only if | 1641 or the priority changes. Redisplay will be affected only if |
1638 the extent has any displayable attributes. */ | 1642 the extent has any displayable attributes. */ |
1639 | 1643 |
1640 static void | 1644 static void |
1641 extent_maybe_changed_for_redisplay (EXTENT extent, int descendants_too) | 1645 extent_maybe_changed_for_redisplay (EXTENT extent, int descendants_too, |
1646 int invisibility_change) | |
1642 { | 1647 { |
1643 /* Retrieve the ancestor for efficiency */ | 1648 /* Retrieve the ancestor for efficiency */ |
1644 EXTENT anc = extent_ancestor (extent); | 1649 EXTENT anc = extent_ancestor (extent); |
1645 if (!NILP (extent_face (anc)) || !NILP (extent_begin_glyph (anc)) || | 1650 if (!NILP (extent_face (anc)) || !NILP (extent_begin_glyph (anc)) || |
1646 !NILP (extent_end_glyph (anc)) || !NILP (extent_mouse_face (anc)) || | 1651 !NILP (extent_end_glyph (anc)) || !NILP (extent_mouse_face (anc)) || |
1647 !NILP (extent_invisible (anc))) | 1652 !NILP (extent_invisible (anc)) || invisibility_change) |
1648 extent_changed_for_redisplay (extent, descendants_too); | 1653 extent_changed_for_redisplay (extent, descendants_too, |
1654 invisibility_change); | |
1649 } | 1655 } |
1650 | 1656 |
1651 static EXTENT | 1657 static EXTENT |
1652 make_extent_detached (Lisp_Object object) | 1658 make_extent_detached (Lisp_Object object) |
1653 { | 1659 { |
1791 Extent_List *el = extent_extent_list (extent); | 1797 Extent_List *el = extent_extent_list (extent); |
1792 | 1798 |
1793 extent_list_insert (el, extent); | 1799 extent_list_insert (el, extent); |
1794 soe_insert (extent_object (extent), extent); | 1800 soe_insert (extent_object (extent), extent); |
1795 /* only this extent changed */ | 1801 /* only this extent changed */ |
1796 extent_maybe_changed_for_redisplay (extent, 0); | 1802 extent_maybe_changed_for_redisplay (extent, 0, |
1803 !NILP (extent_invisible (extent))); | |
1797 } | 1804 } |
1798 | 1805 |
1799 static void | 1806 static void |
1800 extent_detach (EXTENT extent) | 1807 extent_detach (EXTENT extent) |
1801 { | 1808 { |
1804 if (extent_detached_p (extent)) | 1811 if (extent_detached_p (extent)) |
1805 return; | 1812 return; |
1806 el = extent_extent_list (extent); | 1813 el = extent_extent_list (extent); |
1807 | 1814 |
1808 /* call this before messing with the extent. */ | 1815 /* call this before messing with the extent. */ |
1809 extent_maybe_changed_for_redisplay (extent, 0); | 1816 extent_maybe_changed_for_redisplay (extent, 0, |
1817 !NILP (extent_invisible (extent))); | |
1810 extent_list_delete (el, extent); | 1818 extent_list_delete (el, extent); |
1811 soe_delete (extent_object (extent), extent); | 1819 soe_delete (extent_object (extent), extent); |
1812 set_extent_start (extent, -1); | 1820 set_extent_start (extent, -1); |
1813 set_extent_end (extent, -1); | 1821 set_extent_end (extent, -1); |
1814 } | 1822 } |
3509 add_extent_to_children_list (XEXTENT (parent), extent); | 3517 add_extent_to_children_list (XEXTENT (parent), extent); |
3510 set_extent_no_chase_aux_field (e, parent, parent); | 3518 set_extent_no_chase_aux_field (e, parent, parent); |
3511 e->flags.has_parent = 1; | 3519 e->flags.has_parent = 1; |
3512 } | 3520 } |
3513 /* changing the parent also changes the properties of all children. */ | 3521 /* changing the parent also changes the properties of all children. */ |
3514 extent_maybe_changed_for_redisplay (e, 1); | 3522 { |
3523 int old_invis = (!NILP (cur_parent) && | |
3524 !NILP (extent_invisible (XEXTENT (cur_parent)))); | |
3525 int new_invis = (!NILP (parent) && | |
3526 !NILP (extent_invisible (XEXTENT (parent)))); | |
3527 | |
3528 extent_maybe_changed_for_redisplay (e, 1, new_invis != old_invis); | |
3529 } | |
3530 | |
3515 return Qnil; | 3531 return Qnil; |
3516 } | 3532 } |
3517 | 3533 |
3518 | 3534 |
3519 /************************************************************************/ | 3535 /************************************************************************/ |
4608 set_extent_invisible (EXTENT extent, Lisp_Object value) | 4624 set_extent_invisible (EXTENT extent, Lisp_Object value) |
4609 { | 4625 { |
4610 if (!EQ (extent_invisible (extent), value)) | 4626 if (!EQ (extent_invisible (extent), value)) |
4611 { | 4627 { |
4612 set_extent_invisible_1 (extent, value); | 4628 set_extent_invisible_1 (extent, value); |
4613 extent_changed_for_redisplay (extent, 1); | 4629 extent_changed_for_redisplay (extent, 1, 1); |
4614 } | 4630 } |
4615 } | 4631 } |
4616 | 4632 |
4617 /* This function does "memoization" -- similar to the interning | 4633 /* This function does "memoization" -- similar to the interning |
4618 that happens with symbols. Given a list of faces, an equivalent | 4634 that happens with symbols. Given a list of faces, an equivalent |
4765 with faces earlier in the list taking priority over those later in the | 4781 with faces earlier in the list taking priority over those later in the |
4766 list. | 4782 list. |
4767 */ | 4783 */ |
4768 (extent, face)) | 4784 (extent, face)) |
4769 { | 4785 { |
4770 EXTENT e; | 4786 EXTENT e = decode_extent(extent, 0); |
4771 Lisp_Object orig_face = face; | 4787 Lisp_Object orig_face = face; |
4772 | 4788 |
4773 CHECK_EXTENT (extent); | |
4774 e = XEXTENT (extent); | |
4775 /* retrieve the ancestor for efficiency and proper redisplay noting. */ | 4789 /* retrieve the ancestor for efficiency and proper redisplay noting. */ |
4776 e = extent_ancestor (e); | 4790 e = extent_ancestor (e); |
4777 | 4791 |
4778 face = memoize_extent_face_internal (face); | 4792 face = memoize_extent_face_internal (face); |
4779 | 4793 |
4780 extent_face (e) = face; | 4794 extent_face (e) = face; |
4781 extent_changed_for_redisplay (e, 1); | 4795 extent_changed_for_redisplay (e, 1, 0); |
4782 | 4796 |
4783 return orig_face; | 4797 return orig_face; |
4784 } | 4798 } |
4785 | 4799 |
4786 | 4800 |
4816 e = extent_ancestor (e); | 4830 e = extent_ancestor (e); |
4817 | 4831 |
4818 face = memoize_extent_face_internal (face); | 4832 face = memoize_extent_face_internal (face); |
4819 | 4833 |
4820 set_extent_mouse_face (e, face); | 4834 set_extent_mouse_face (e, face); |
4821 extent_changed_for_redisplay (e, 1); | 4835 extent_changed_for_redisplay (e, 1, 0); |
4822 | 4836 |
4823 return orig_face; | 4837 return orig_face; |
4824 } | 4838 } |
4825 | 4839 |
4826 void | 4840 void |
4838 { | 4852 { |
4839 set_extent_end_glyph (extent, glyph); | 4853 set_extent_end_glyph (extent, glyph); |
4840 extent_end_glyph_layout (extent) = layout; | 4854 extent_end_glyph_layout (extent) = layout; |
4841 } | 4855 } |
4842 | 4856 |
4843 extent_changed_for_redisplay (extent, 1); | 4857 extent_changed_for_redisplay (extent, 1, 0); |
4844 } | 4858 } |
4845 | 4859 |
4846 static Lisp_Object | 4860 static Lisp_Object |
4847 glyph_layout_to_symbol (unsigned int layout) | 4861 glyph_layout_to_symbol (unsigned int layout) |
4848 { | 4862 { |
4940 (extent, layout)) | 4954 (extent, layout)) |
4941 { | 4955 { |
4942 EXTENT e = decode_extent (extent, 0); | 4956 EXTENT e = decode_extent (extent, 0); |
4943 e = extent_ancestor (e); | 4957 e = extent_ancestor (e); |
4944 extent_begin_glyph_layout (e) = symbol_to_glyph_layout (layout); | 4958 extent_begin_glyph_layout (e) = symbol_to_glyph_layout (layout); |
4945 extent_maybe_changed_for_redisplay (e, 1); | 4959 extent_maybe_changed_for_redisplay (e, 1, 0); |
4946 return layout; | 4960 return layout; |
4947 } | 4961 } |
4948 | 4962 |
4949 DEFUN ("set-extent-end-glyph-layout", Fset_extent_end_glyph_layout, 2, 2, 0, /* | 4963 DEFUN ("set-extent-end-glyph-layout", Fset_extent_end_glyph_layout, 2, 2, 0, /* |
4950 Set the layout policy of the given extent's end glyph. | 4964 Set the layout policy of the given extent's end glyph. |
4953 (extent, layout)) | 4967 (extent, layout)) |
4954 { | 4968 { |
4955 EXTENT e = decode_extent (extent, 0); | 4969 EXTENT e = decode_extent (extent, 0); |
4956 e = extent_ancestor (e); | 4970 e = extent_ancestor (e); |
4957 extent_end_glyph_layout (e) = symbol_to_glyph_layout (layout); | 4971 extent_end_glyph_layout (e) = symbol_to_glyph_layout (layout); |
4958 extent_maybe_changed_for_redisplay (e, 1); | 4972 extent_maybe_changed_for_redisplay (e, 1, 0); |
4959 return layout; | 4973 return layout; |
4960 } | 4974 } |
4961 | 4975 |
4962 DEFUN ("extent-begin-glyph-layout", Fextent_begin_glyph_layout, 1, 1, 0, /* | 4976 DEFUN ("extent-begin-glyph-layout", Fextent_begin_glyph_layout, 1, 1, 0, /* |
4963 Return the layout policy associated with the given extent's begin glyph. | 4977 Return the layout policy associated with the given extent's begin glyph. |
4992 EXTENT e = decode_extent (extent, 0); | 5006 EXTENT e = decode_extent (extent, 0); |
4993 | 5007 |
4994 CHECK_INT (pri); | 5008 CHECK_INT (pri); |
4995 e = extent_ancestor (e); | 5009 e = extent_ancestor (e); |
4996 set_extent_priority (e, XINT (pri)); | 5010 set_extent_priority (e, XINT (pri)); |
4997 extent_maybe_changed_for_redisplay (e, 1); | 5011 extent_maybe_changed_for_redisplay (e, 1, 0); |
4998 return pri; | 5012 return pri; |
4999 } | 5013 } |
5000 | 5014 |
5001 DEFUN ("extent-priority", Fextent_priority, 1, 1, 0, /* | 5015 DEFUN ("extent-priority", Fextent_priority, 1, 1, 0, /* |
5002 Return the display priority of EXTENT; see `set-extent-priority'. | 5016 Return the display priority of EXTENT; see `set-extent-priority'. |
5372 if (EXTENTP (Vlast_highlighted_extent) && | 5386 if (EXTENTP (Vlast_highlighted_extent) && |
5373 EXTENT_LIVE_P (XEXTENT (Vlast_highlighted_extent))) | 5387 EXTENT_LIVE_P (XEXTENT (Vlast_highlighted_extent))) |
5374 { | 5388 { |
5375 /* do not recurse on descendants. Only one extent is highlighted | 5389 /* do not recurse on descendants. Only one extent is highlighted |
5376 at a time. */ | 5390 at a time. */ |
5377 extent_changed_for_redisplay (XEXTENT (Vlast_highlighted_extent), 0); | 5391 extent_changed_for_redisplay (XEXTENT (Vlast_highlighted_extent), 0, 0); |
5378 } | 5392 } |
5379 Vlast_highlighted_extent = Qnil; | 5393 Vlast_highlighted_extent = Qnil; |
5380 if (!NILP (extent_obj) | 5394 if (!NILP (extent_obj) |
5381 && BUFFERP (extent_object (XEXTENT (extent_obj))) | 5395 && BUFFERP (extent_object (XEXTENT (extent_obj))) |
5382 && highlight_p) | 5396 && highlight_p) |
5383 { | 5397 { |
5384 extent_changed_for_redisplay (XEXTENT (extent_obj), 0); | 5398 extent_changed_for_redisplay (XEXTENT (extent_obj), 0, 0); |
5385 Vlast_highlighted_extent = extent_obj; | 5399 Vlast_highlighted_extent = extent_obj; |
5386 } | 5400 } |
5387 } | 5401 } |
5388 | 5402 |
5389 DEFUN ("force-highlight-extent", Fforce_highlight_extent, 1, 2, 0, /* | 5403 DEFUN ("force-highlight-extent", Fforce_highlight_extent, 1, 2, 0, /* |