aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2002-11-15 20:06:03 +0000
committerStefan Monnier2002-11-15 20:06:03 +0000
commit14e40288da4177bf3a54b885e38df7888a2c59f2 (patch)
tree5d892f446b7cc1cbda699242c521132063248972 /src
parent197edd3510a58777ef5ea3f4945e3e6176820631 (diff)
downloademacs-14e40288da4177bf3a54b885e38df7888a2c59f2.tar.gz
emacs-14e40288da4177bf3a54b885e38df7888a2c59f2.zip
(command_loop_1): Fix int/Lisp_Object mixup.
(adjust_point_for_property): Move out of display and invisible even if we were already inside before (in case a property was added while we weren't looking). Be more careful when handling invisible props. Skip invisible text as if it really wasn't there at all. (interrupt_signal): Mark static.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c105
1 files changed, 77 insertions, 28 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 2984a369734..fd726a5a254 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1629,12 +1629,13 @@ command_loop_1 ()
1629 goto directly_done; 1629 goto directly_done;
1630 } 1630 }
1631 else if (EQ (Vthis_command, Qself_insert_command) 1631 else if (EQ (Vthis_command, Qself_insert_command)
1632 /* Try this optimization only on character keystrokes. */ 1632 /* Try this optimization only on char keystrokes. */
1633 && CHAR_VALID_P (last_command_char, 0)) 1633 && NATNUMP (last_command_char)
1634 && CHAR_VALID_P (XFASTINT (last_command_char), 0))
1634 { 1635 {
1635 unsigned int c = 1636 unsigned int c =
1636 translate_char (Vtranslation_table_for_input, 1637 translate_char (Vtranslation_table_for_input,
1637 XINT (last_command_char), 0, 0, 0); 1638 XFASTINT (last_command_char), 0, 0, 0);
1638 int value; 1639 int value;
1639 if (NILP (Vexecuting_macro) 1640 if (NILP (Vexecuting_macro)
1640 && !EQ (minibuf_window, selected_window)) 1641 && !EQ (minibuf_window, selected_window))
@@ -1790,6 +1791,9 @@ extern Lisp_Object Qcomposition, Qdisplay;
1790 `composition', `display' and `invisible' properties. 1791 `composition', `display' and `invisible' properties.
1791 LAST_PT is the last position of point. */ 1792 LAST_PT is the last position of point. */
1792 1793
1794extern Lisp_Object Qafter_string, Qbefore_string;
1795extern Lisp_Object get_pos_property P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
1796
1793static void 1797static void
1794adjust_point_for_property (last_pt) 1798adjust_point_for_property (last_pt)
1795 int last_pt; 1799 int last_pt;
@@ -1807,9 +1811,9 @@ adjust_point_for_property (last_pt)
1807 && beg < PT /* && end > PT <- It's always the case. */ 1811 && beg < PT /* && end > PT <- It's always the case. */
1808 && (last_pt <= beg || last_pt >= end)) 1812 && (last_pt <= beg || last_pt >= end))
1809 { 1813 {
1814 xassert (end > PT);
1810 SET_PT (PT < last_pt ? beg : end); 1815 SET_PT (PT < last_pt ? beg : end);
1811 check_display = 1; 1816 check_display = check_invisible = 1;
1812 check_invisible = 1;
1813 } 1817 }
1814 check_composition = 0; 1818 check_composition = 0;
1815 if (check_display 1819 if (check_display
@@ -1821,31 +1825,75 @@ adjust_point_for_property (last_pt)
1821 ? get_property_and_range (PT, Qdisplay, &val, &beg, &end, Qnil) 1825 ? get_property_and_range (PT, Qdisplay, &val, &beg, &end, Qnil)
1822 : (beg = OVERLAY_POSITION (OVERLAY_START (overlay)), 1826 : (beg = OVERLAY_POSITION (OVERLAY_START (overlay)),
1823 end = OVERLAY_POSITION (OVERLAY_END (overlay)))) 1827 end = OVERLAY_POSITION (OVERLAY_END (overlay))))
1824 && beg < PT /* && end > PT <- It's always the case. */ 1828 && beg < PT) /* && end > PT <- It's always the case. */
1825 && (last_pt <= beg || last_pt >= end))
1826 { 1829 {
1830 xassert (end > PT);
1827 SET_PT (PT < last_pt ? beg : end); 1831 SET_PT (PT < last_pt ? beg : end);
1828 check_composition = 1; 1832 check_composition = check_invisible = 1;
1829 check_invisible = 1;
1830 } 1833 }
1831 check_display = 0; 1834 check_display = 0;
1832 if (check_invisible 1835 if (check_invisible && PT > BEGV && PT < ZV)
1833 && PT > BEGV && PT < ZV
1834 && !NILP (val = get_char_property_and_overlay
1835 (make_number (PT), Qinvisible, Qnil, &overlay))
1836 && TEXT_PROP_MEANS_INVISIBLE (val)
1837 && (tmp = Fprevious_single_char_property_change
1838 (make_number (PT + 1), Qinvisible, Qnil, Qnil),
1839 beg = NILP (tmp) ? BEGV : XFASTINT (tmp),
1840 beg < PT)
1841 && (tmp = Fnext_single_char_property_change
1842 (make_number (PT), Qinvisible, Qnil, Qnil),
1843 end = NILP (tmp) ? ZV : XFASTINT (tmp),
1844 (last_pt <= beg || last_pt >= end)))
1845 { 1836 {
1846 SET_PT (PT < last_pt ? beg : end); 1837 int inv, ellipsis = 0;
1847 check_composition = 1; 1838 beg = end = PT;
1848 check_display = 1; 1839
1840 /* Find boundaries `beg' and `end' of the invisible area, if any. */
1841 while (end < ZV
1842 && !NILP (val = get_char_property_and_overlay
1843 (make_number (end), Qinvisible, Qnil, &overlay))
1844 && (inv = TEXT_PROP_MEANS_INVISIBLE (val)))
1845 {
1846 ellipsis = ellipsis || inv > 1
1847 || (OVERLAYP (overlay)
1848 && (!NILP (Foverlay_get (overlay, Qafter_string))
1849 || !NILP (Foverlay_get (overlay, Qbefore_string))));
1850 tmp = Fnext_single_char_property_change
1851 (make_number (end), Qinvisible, Qnil, Qnil);
1852 end = NATNUMP (tmp) ? XFASTINT (tmp) : ZV;
1853 }
1854 while (beg > BEGV
1855 && !NILP (val = get_char_property_and_overlay
1856 (make_number (beg - 1), Qinvisible, Qnil, &overlay))
1857 && (inv = TEXT_PROP_MEANS_INVISIBLE (val)))
1858 {
1859 ellipsis = ellipsis || inv > 1
1860 || (OVERLAYP (overlay)
1861 && (!NILP (Foverlay_get (overlay, Qafter_string))
1862 || !NILP (Foverlay_get (overlay, Qbefore_string))));
1863 tmp = Fprevious_single_char_property_change
1864 (make_number (beg), Qinvisible, Qnil, Qnil);
1865 beg = NATNUMP (tmp) ? XFASTINT (tmp) : BEGV;
1866 }
1867
1868 /* Move away from the inside area. */
1869 if (beg < PT && end > PT)
1870 {
1871 SET_PT (PT < last_pt ? beg : end);
1872 check_composition = check_display = 1;
1873 }
1874 xassert (PT == beg || PT == end);
1875 /* Pretend the area doesn't exist. */
1876 if (!ellipsis && beg < end)
1877 {
1878 if (last_pt == beg && PT == end && end < ZV)
1879 (check_composition = check_display = 1, SET_PT (end + 1));
1880 else if (last_pt == end && PT == beg && beg > BEGV)
1881 (check_composition = check_display = 1, SET_PT (beg - 1));
1882 else if (PT == ((PT < last_pt) ? beg : end))
1883 /* We've already moved as far as we can. Trying to go
1884 to the other end would mean moving backwards and thus
1885 could lead to an infinite loop. */
1886 ;
1887 else if (val = get_pos_property (make_number (PT),
1888 Qinvisible, Qnil),
1889 TEXT_PROP_MEANS_INVISIBLE (val)
1890 && (val = get_pos_property
1891 (make_number (PT == beg ? end : beg),
1892 Qinvisible, Qnil),
1893 !TEXT_PROP_MEANS_INVISIBLE (val)))
1894 (check_composition = check_display = 1,
1895 SET_PT (PT == beg ? end : beg));
1896 }
1849 } 1897 }
1850 check_invisible = 0; 1898 check_invisible = 0;
1851 } 1899 }
@@ -5310,7 +5358,7 @@ make_lispy_event (event)
5310 /* Get the symbol we should use for the mouse click. */ 5358 /* Get the symbol we should use for the mouse click. */
5311 head = modify_event_symbol (event->code, 5359 head = modify_event_symbol (event->code,
5312 event->modifiers, 5360 event->modifiers,
5313 Qmouse_click, 5361 Qmouse_click,
5314 Vlispy_mouse_stem, 5362 Vlispy_mouse_stem,
5315 NULL, &mouse_syms, 5363 NULL, &mouse_syms,
5316 XVECTOR (mouse_syms)->size); 5364 XVECTOR (mouse_syms)->size);
@@ -7670,7 +7718,7 @@ read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu)
7670 int *used_mouse_menu; 7718 int *used_mouse_menu;
7671{ 7719{
7672 int mapno; 7720 int mapno;
7673 register Lisp_Object name; 7721 register Lisp_Object name = Qnil;
7674 7722
7675 if (used_mouse_menu) 7723 if (used_mouse_menu)
7676 *used_mouse_menu = 0; 7724 *used_mouse_menu = 0;
@@ -7772,6 +7820,7 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
7772 int mapno; 7820 int mapno;
7773 register Lisp_Object name; 7821 register Lisp_Object name;
7774 int nlength; 7822 int nlength;
7823 /* FIXME: Use the minibuffer's frame width. */
7775 int width = FRAME_WIDTH (SELECTED_FRAME ()) - 4; 7824 int width = FRAME_WIDTH (SELECTED_FRAME ()) - 4;
7776 int idx = -1; 7825 int idx = -1;
7777 int nobindings = 1; 7826 int nobindings = 1;
@@ -10033,7 +10082,7 @@ clear_waiting_for_input ()
10033 eval to throw, when it gets a chance. If quit-flag is already 10082 eval to throw, when it gets a chance. If quit-flag is already
10034 non-nil, it stops the job right away. */ 10083 non-nil, it stops the job right away. */
10035 10084
10036SIGTYPE 10085static SIGTYPE
10037interrupt_signal (signalnum) /* If we don't have an argument, */ 10086interrupt_signal (signalnum) /* If we don't have an argument, */
10038 int signalnum; /* some compilers complain in signal calls. */ 10087 int signalnum; /* some compilers complain in signal calls. */
10039{ 10088{