aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorStefan Monnier2002-11-03 09:00:47 +0000
committerStefan Monnier2002-11-03 09:00:47 +0000
commit7e16ef60e42c1b7af5ceca2fe8ecfc42e49eb029 (patch)
tree7e734da1ab8558418d252c887522db378aab08db /src/keyboard.c
parent5f1fbf6b356aefc0645f9494a4a04ee19eb5510f (diff)
downloademacs-7e16ef60e42c1b7af5ceca2fe8ecfc42e49eb029.tar.gz
emacs-7e16ef60e42c1b7af5ceca2fe8ecfc42e49eb029.zip
(adjust_point_for_property): Handle `display' prop on overlays.
Also handle `invisible' prop.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c62
1 files changed, 41 insertions, 21 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 726f8354156..c0afb84c3c4 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1785,47 +1785,67 @@ extern Lisp_Object Qcomposition, Qdisplay;
1785 1785
1786/* Adjust point to a boundary of a region that has such a property 1786/* Adjust point to a boundary of a region that has such a property
1787 that should be treated intangible. For the moment, we check 1787 that should be treated intangible. For the moment, we check
1788 `composition' and `display' property. LAST_PT is the last position 1788 `composition', `display' and `invisible' properties.
1789 of point. */ 1789 LAST_PT is the last position of point. */
1790 1790
1791static void 1791static void
1792adjust_point_for_property (last_pt) 1792adjust_point_for_property (last_pt)
1793 int last_pt; 1793 int last_pt;
1794{ 1794{
1795 int start, end; 1795 int beg, end;
1796 Lisp_Object val; 1796 Lisp_Object val, overlay, tmp;
1797 int check_composition = 1, check_display = 1; 1797 int check_composition = 1, check_display = 1, check_invisible = 1;
1798 1798
1799 while (check_composition || check_display) 1799 while (check_composition || check_display || check_invisible)
1800 { 1800 {
1801 if (check_composition 1801 if (check_composition
1802 && PT > BEGV && PT < ZV 1802 && PT > BEGV && PT < ZV
1803 && get_property_and_range (PT, Qcomposition, &val, &start, &end, Qnil) 1803 && get_property_and_range (PT, Qcomposition, &val, &beg, &end, Qnil)
1804 && COMPOSITION_VALID_P (start, end, val) 1804 && COMPOSITION_VALID_P (beg, end, val)
1805 && start < PT && end > PT 1805 && beg < PT /* && end > PT <- It's always the case. */
1806 && (last_pt <= start || last_pt >= end)) 1806 && (last_pt <= beg || last_pt >= end))
1807 { 1807 {
1808 if (PT < last_pt) 1808 SET_PT (PT < last_pt ? beg : end);
1809 SET_PT (start);
1810 else
1811 SET_PT (end);
1812 check_display = 1; 1809 check_display = 1;
1810 check_invisible = 1;
1813 } 1811 }
1814 check_composition = 0; 1812 check_composition = 0;
1815 if (check_display 1813 if (check_display
1816 && PT > BEGV && PT < ZV 1814 && PT > BEGV && PT < ZV
1817 && get_property_and_range (PT, Qdisplay, &val, &start, &end, Qnil) 1815 && !NILP (val = get_char_property_and_overlay
1816 (make_number (PT), Qdisplay, Qnil, &overlay))
1818 && display_prop_intangible_p (val) 1817 && display_prop_intangible_p (val)
1819 && start < PT && end > PT 1818 && (!OVERLAYP (overlay)
1820 && (last_pt <= start || last_pt >= end)) 1819 ? get_property_and_range (PT, Qdisplay, &val, &beg, &end, Qnil)
1820 : (beg = OVERLAY_POSITION (OVERLAY_START (overlay)),
1821 end = OVERLAY_POSITION (OVERLAY_END (overlay))))
1822 && beg < PT /* && end > PT <- It's always the case. */
1823 && (last_pt <= beg || last_pt >= end))
1821 { 1824 {
1822 if (PT < last_pt) 1825 SET_PT (PT < last_pt ? beg : end);
1823 SET_PT (start);
1824 else
1825 SET_PT (end);
1826 check_composition = 1; 1826 check_composition = 1;
1827 check_invisible = 1;
1827 } 1828 }
1828 check_display = 0; 1829 check_display = 0;
1830 if (check_invisible
1831 && PT > BEGV && PT < ZV
1832 && !NILP (val = get_char_property_and_overlay
1833 (make_number (PT), Qinvisible, Qnil, &overlay))
1834 && TEXT_PROP_MEANS_INVISIBLE (val)
1835 && (tmp = Fprevious_single_char_property_change
1836 (make_number (PT + 1), Qinvisible, Qnil, Qnil),
1837 beg = NILP (tmp) ? BEGV : XFASTINT (tmp),
1838 beg < PT)
1839 && (tmp = Fnext_single_char_property_change
1840 (make_number (PT), Qinvisible, Qnil, Qnil),
1841 end = NILP (tmp) ? BEGV : XFASTINT (tmp),
1842 (last_pt <= beg || last_pt >= end)))
1843 {
1844 SET_PT (PT < last_pt ? beg : end);
1845 check_composition = 1;
1846 check_display = 1;
1847 }
1848 check_invisible = 0;
1829 } 1849 }
1830} 1850}
1831 1851