comparison src/xdisp.c @ 10965:1ade2d8b0ae9

(display_text_line): When setting selective_rlen, ignore whether selective display is on or off. (display_text_line, try_window): Check `invisible' prop using TEXT_PROP_MEANS_INVISIBLE. (display_text_line): Check TEXT_PROP_MEANS_INVISIBLE_WITH_ELLIPSIS; if it says so, use ellipses after invisible text. (invisible_p, invisible_ellipsis_p): New functions.
author Richard M. Stallman <rms@gnu.org>
date Sat, 11 Mar 1995 22:34:35 +0000
parents 83fb3fdeda96
children c3af543e6259
comparison
equal deleted inserted replaced
10964:474b6b03a71f 10965:1ade2d8b0ae9
1674 tab_offset -= minibuf_prompt_width; 1674 tab_offset -= minibuf_prompt_width;
1675 1675
1676 if (val.vpos) tab_offset = 0; 1676 if (val.vpos) tab_offset = 0;
1677 vpos++; 1677 vpos++;
1678 if (pos != val.bufpos) 1678 if (pos != val.bufpos)
1679 last_text_vpos 1679 {
1680 /* Next line, unless prev line ended in end of buffer with no cr */ 1680 int invis = 0;
1681 = vpos - (val.vpos && (FETCH_CHAR (val.bufpos - 1) != '\n'
1682 #ifdef USE_TEXT_PROPERTIES 1681 #ifdef USE_TEXT_PROPERTIES
1683 || ! NILP (Fget_char_property (val.bufpos-1, 1682 Lisp_Object invis_prop;
1684 Qinvisible, 1683 invis_prop = Fget_char_property (val.bufpos-1, Qinvisible, window);
1685 window)) 1684 invis = TEXT_PROP_MEANS_INVISIBLE (invis_prop);
1686 #endif 1685 #endif
1687 )); 1686
1687 last_text_vpos
1688 /* Next line, unless prev line ended in end of buffer with no cr */
1689 = vpos - (val.vpos
1690 && (FETCH_CHAR (val.bufpos - 1) != '\n' || invis));
1691 }
1688 pos = val.bufpos; 1692 pos = val.bufpos;
1689 } 1693 }
1690 1694
1691 /* If last line is continued in middle of character, 1695 /* If last line is continued in middle of character,
1692 include the split character in the text considered on the frame */ 1696 include the split character in the text considered on the frame */
2292 int ctl_arrow = !NILP (current_buffer->ctl_arrow); 2296 int ctl_arrow = !NILP (current_buffer->ctl_arrow);
2293 int width = window_internal_width (w) - 1; 2297 int width = window_internal_width (w) - 1;
2294 struct position val; 2298 struct position val;
2295 int lastpos; 2299 int lastpos;
2296 int invis; 2300 int invis;
2301 int last_invis_skip = 0;
2302 Lisp_Object last_invis_prop;
2297 int hscroll = XINT (w->hscroll); 2303 int hscroll = XINT (w->hscroll);
2298 int truncate = (hscroll 2304 int truncate = (hscroll
2299 || (truncate_partial_width_windows 2305 || (truncate_partial_width_windows
2300 && XFASTINT (w->width) < FRAME_WIDTH (f)) 2306 && XFASTINT (w->width) < FRAME_WIDTH (f))
2301 || !NILP (current_buffer->truncate_lines)); 2307 || !NILP (current_buffer->truncate_lines));
2310 : !NILP (current_buffer->selective_display) ? -1 : 0); 2316 : !NILP (current_buffer->selective_display) ? -1 : 0);
2311 register struct frame_glyphs *desired_glyphs = FRAME_DESIRED_GLYPHS (f); 2317 register struct frame_glyphs *desired_glyphs = FRAME_DESIRED_GLYPHS (f);
2312 register struct Lisp_Vector *dp = window_display_table (w); 2318 register struct Lisp_Vector *dp = window_display_table (w);
2313 2319
2314 Lisp_Object default_invis_vector[3]; 2320 Lisp_Object default_invis_vector[3];
2315 /* Nonzero means display something where there are invisible lines. 2321 /* Number of characters of ellipsis to display after an invisible line
2316 The precise value is the number of glyphs to display. */ 2322 if it calls for an ellipsis.
2323 Note that this value can be nonzero regardless of whether
2324 selective display is enabled--you must check that separately. */
2317 int selective_rlen 2325 int selective_rlen
2318 = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp)) 2326 = (dp && VECTORP (DISP_INVIS_VECTOR (dp))
2319 ? XVECTOR (DISP_INVIS_VECTOR (dp))->size 2327 ? XVECTOR (DISP_INVIS_VECTOR (dp))->size
2320 : selective && !NILP (current_buffer->selective_display_ellipses) 2328 : !NILP (current_buffer->selective_display_ellipses) ? 3 : 0);
2321 ? 3 : 0);
2322 /* This is the sequence of Lisp objects to display 2329 /* This is the sequence of Lisp objects to display
2323 when there are invisible lines. */ 2330 when there are invisible lines. */
2324 Lisp_Object *invis_vector_contents 2331 Lisp_Object *invis_vector_contents
2325 = (dp && VECTORP (DISP_INVIS_VECTOR (dp)) 2332 = (dp && VECTORP (DISP_INVIS_VECTOR (dp))
2326 ? XVECTOR (DISP_INVIS_VECTOR (dp))->contents 2333 ? XVECTOR (DISP_INVIS_VECTOR (dp))->contents
2490 performance; nothing should go wrong if it is too small. */ 2497 performance; nothing should go wrong if it is too small. */
2491 limit = Fnext_overlay_change (position); 2498 limit = Fnext_overlay_change (position);
2492 if (XFASTINT (limit) > pos + 50) 2499 if (XFASTINT (limit) > pos + 50)
2493 XSETFASTINT (limit, pos + 50); 2500 XSETFASTINT (limit, pos + 50);
2494 endpos = Fnext_single_property_change (position, Qinvisible, 2501 endpos = Fnext_single_property_change (position, Qinvisible,
2495 Fcurrent_buffer (), limit); 2502 Fcurrent_buffer (),
2503 limit);
2496 if (INTEGERP (endpos)) 2504 if (INTEGERP (endpos))
2497 next_invisible = XINT (endpos); 2505 next_invisible = XINT (endpos);
2498 else 2506 else
2499 next_invisible = end; 2507 next_invisible = end;
2500 if (! NILP (prop)) 2508 if (TEXT_PROP_MEANS_INVISIBLE (prop))
2501 { 2509 {
2502 if (pos < PT && next_invisible >= PT) 2510 if (pos < PT && next_invisible >= PT)
2503 { 2511 {
2504 cursor_vpos = vpos; 2512 cursor_vpos = vpos;
2505 cursor_hpos = p1 - leftmargin; 2513 cursor_hpos = p1 - leftmargin;
2506 } 2514 }
2507 pos = next_invisible; 2515 pos = next_invisible;
2516 last_invis_skip = pos;
2517 last_invis_prop = prop;
2508 } 2518 }
2509 } 2519 }
2510 if (pos >= end) 2520 if (pos >= end)
2511 break; 2521 break;
2512 #endif 2522 #endif
2555 p1++; 2565 p1++;
2556 } 2566 }
2557 else if (c == '\n') 2567 else if (c == '\n')
2558 { 2568 {
2559 invis = 0; 2569 invis = 0;
2570 if (last_invis_skip == pos
2571 && TEXT_PROP_MEANS_INVISIBLE_WITH_ELLIPSIS (last_invis_prop))
2572 invis = 1;
2560 while (pos + 1 < end 2573 while (pos + 1 < end
2561 && selective > 0 2574 && selective > 0
2562 && indented_beyond_p (pos + 1, selective)) 2575 && indented_beyond_p (pos + 1, selective))
2563 { 2576 {
2564 invis = 1; 2577 invis = 1;
3820 3833
3821 return len; 3834 return len;
3822 } 3835 }
3823 } 3836 }
3824 3837
3838 /* This is like a combination of memq and assq.
3839 Return 1 if PROPVAL appears as an element of LIST
3840 or as the car of an element of LIST.
3841 Otherwise return 0.
3842 This function cannot quit. */
3843
3844 int
3845 invisible_p (propval, list)
3846 register Lisp_Object propval;
3847 Lisp_Object list;
3848 {
3849 register Lisp_Object tail;
3850 for (tail = list; CONSP (tail); tail = Fcdr (tail))
3851 {
3852 register Lisp_Object tem;
3853 tem = Fcar (tail);
3854 if (EQ (propval, tem))
3855 return 1;
3856 if (CONSP (tem) && EQ (propval, XCONS (tem)->car))
3857 return 1;
3858 }
3859 return 0;
3860 }
3861
3862 /* Return 1 if PROPVAL appears as the car of an element of LIST
3863 and the cdr of that element is non-nil.
3864 Otherwise return 0.
3865 This function cannot quit. */
3866
3867 int
3868 invisible_ellipsis_p (propval, list)
3869 register Lisp_Object propval;
3870 Lisp_Object list;
3871 {
3872 register Lisp_Object tail;
3873 for (tail = list; CONSP (tail); tail = Fcdr (tail))
3874 {
3875 register Lisp_Object tem;
3876 tem = Fcar (tail);
3877 if (CONSP (tem) && EQ (propval, XCONS (tem)->car))
3878 return ! NILP (XCONS (tem)->cdr);
3879 }
3880 return 0;
3881 }
3882
3825 void 3883 void
3826 syms_of_xdisp () 3884 syms_of_xdisp ()
3827 { 3885 {
3828 staticpro (&Qmenu_bar_update_hook); 3886 staticpro (&Qmenu_bar_update_hook);
3829 Qmenu_bar_update_hook = intern ("menu-bar-update-hook"); 3887 Qmenu_bar_update_hook = intern ("menu-bar-update-hook");