comparison src/xdisp.c @ 91367:c70e45a7acfd

Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-324
author Miles Bader <miles@gnu.org>
date Wed, 30 Jan 2008 07:57:28 +0000
parents 606f2d163a64 5ca564f6a9e6
children 590316ce824f
comparison
equal deleted inserted replaced
91366:86f3a8f0a3a6 91367:c70e45a7acfd
237 extern Lisp_Object Qwhen; 237 extern Lisp_Object Qwhen;
238 extern Lisp_Object Qhelp_echo; 238 extern Lisp_Object Qhelp_echo;
239 239
240 Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map; 240 Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
241 Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions; 241 Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
242 Lisp_Object Qwindow_text_change_functions, Vwindow_text_change_functions;
242 Lisp_Object Qredisplay_end_trigger_functions, Vredisplay_end_trigger_functions; 243 Lisp_Object Qredisplay_end_trigger_functions, Vredisplay_end_trigger_functions;
243 Lisp_Object Qinhibit_point_motion_hooks; 244 Lisp_Object Qinhibit_point_motion_hooks;
244 Lisp_Object QCeval, QCfile, QCdata, QCpropertize; 245 Lisp_Object QCeval, QCfile, QCdata, QCpropertize;
245 Lisp_Object Qfontified; 246 Lisp_Object Qfontified;
246 Lisp_Object Qgrow_only; 247 Lisp_Object Qgrow_only;
694 695
695 /* Non-zero means automatically scroll windows horizontally to make 696 /* Non-zero means automatically scroll windows horizontally to make
696 point visible. */ 697 point visible. */
697 698
698 int automatic_hscrolling_p; 699 int automatic_hscrolling_p;
700 Lisp_Object Qauto_hscroll_mode;
699 701
700 /* How close to the margin can point get before the window is scrolled 702 /* How close to the margin can point get before the window is scrolled
701 horizontally. */ 703 horizontally. */
702 EMACS_INT hscroll_margin; 704 EMACS_INT hscroll_margin;
703 705
1326 visible_p = bottom_y > window_top_y; 1328 visible_p = bottom_y > window_top_y;
1327 else if (top_y < it.last_visible_y) 1329 else if (top_y < it.last_visible_y)
1328 visible_p = 1; 1330 visible_p = 1;
1329 if (visible_p) 1331 if (visible_p)
1330 { 1332 {
1333 Lisp_Object window, prop;
1334
1335 XSETWINDOW (window, w);
1336 prop = Fget_char_property (make_number (it.position.charpos),
1337 Qinvisible, window);
1338
1339 /* If charpos coincides with invisible text covered with an
1340 ellipsis, use the first glyph of the ellipsis to compute
1341 the pixel positions. */
1342 if (TEXT_PROP_MEANS_INVISIBLE (prop) == 2)
1343 {
1344 struct glyph_row *row = it.glyph_row;
1345 struct glyph *glyph = row->glyphs[TEXT_AREA];
1346 struct glyph *end = glyph + row->used[TEXT_AREA];
1347 int x = row->x;
1348
1349 for (; glyph < end && glyph->charpos < charpos; glyph++)
1350 x += glyph->pixel_width;
1351
1352 top_x = x;
1353 }
1354
1331 *x = top_x; 1355 *x = top_x;
1332 *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y); 1356 *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y);
1333 *rtop = max (0, window_top_y - top_y); 1357 *rtop = max (0, window_top_y - top_y);
1334 *rbot = max (0, bottom_y - it.last_visible_y); 1358 *rbot = max (0, bottom_y - it.last_visible_y);
1335 *rowh = max (0, (min (bottom_y, it.last_visible_y) 1359 *rowh = max (0, (min (bottom_y, it.last_visible_y)
8934 8958
8935 /* Don't display if frame is invisible or not yet initialized. */ 8959 /* Don't display if frame is invisible or not yet initialized. */
8936 if (!FRAME_VISIBLE_P (f) || !f->glyphs_initialized_p) 8960 if (!FRAME_VISIBLE_P (f) || !f->glyphs_initialized_p)
8937 return 0; 8961 return 0;
8938 8962
8939 /* The terminal frame is used as the first Emacs frame on the Mac OS. */
8940 #ifndef MAC_OS8
8941 #ifdef HAVE_WINDOW_SYSTEM 8963 #ifdef HAVE_WINDOW_SYSTEM
8942 /* When Emacs starts, selected_frame may be the initial terminal 8964 /* When Emacs starts, selected_frame may be the initial terminal
8943 frame. If we let this through, a message would be displayed on 8965 frame. If we let this through, a message would be displayed on
8944 the terminal. */ 8966 the terminal. */
8945 if (FRAME_INITIAL_P (XFRAME (selected_frame))) 8967 if (FRAME_INITIAL_P (XFRAME (selected_frame)))
8946 return 0; 8968 return 0;
8947 #endif /* HAVE_WINDOW_SYSTEM */ 8969 #endif /* HAVE_WINDOW_SYSTEM */
8948 #endif
8949 8970
8950 /* Redraw garbaged frames. */ 8971 /* Redraw garbaged frames. */
8951 if (frame_garbaged) 8972 if (frame_garbaged)
8952 clear_garbaged_frames (); 8973 clear_garbaged_frames ();
8953 8974
10533 text_area_width = window_box_width (w, TEXT_AREA); 10554 text_area_width = window_box_width (w, TEXT_AREA);
10534 10555
10535 /* Scroll when cursor is inside this scroll margin. */ 10556 /* Scroll when cursor is inside this scroll margin. */
10536 h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w); 10557 h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w);
10537 10558
10538 if ((XFASTINT (w->hscroll) 10559 if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->buffer))
10539 && w->cursor.x <= h_margin) 10560 && ((XFASTINT (w->hscroll)
10540 || (cursor_row->enabled_p 10561 && w->cursor.x <= h_margin)
10541 && cursor_row->truncated_on_right_p 10562 || (cursor_row->enabled_p
10542 && (w->cursor.x >= text_area_width - h_margin))) 10563 && cursor_row->truncated_on_right_p
10564 && (w->cursor.x >= text_area_width - h_margin))))
10543 { 10565 {
10544 struct it it; 10566 struct it it;
10545 int hscroll; 10567 int hscroll;
10546 struct buffer *saved_current_buffer; 10568 struct buffer *saved_current_buffer;
10547 int pt; 10569 int pt;
10627 10649
10628 static int 10650 static int
10629 hscroll_windows (window) 10651 hscroll_windows (window)
10630 Lisp_Object window; 10652 Lisp_Object window;
10631 { 10653 {
10632 int hscrolled_p; 10654 int hscrolled_p = hscroll_window_tree (window);
10633 10655 if (hscrolled_p)
10634 if (automatic_hscrolling_p) 10656 clear_desired_matrices (XFRAME (WINDOW_FRAME (XWINDOW (window))));
10635 {
10636 hscrolled_p = hscroll_window_tree (window);
10637 if (hscrolled_p)
10638 clear_desired_matrices (XFRAME (WINDOW_FRAME (XWINDOW (window))));
10639 }
10640 else
10641 hscrolled_p = 0;
10642 return hscrolled_p; 10657 return hscrolled_p;
10643 } 10658 }
10644 10659
10645 10660
10646 10661
13030 xassert (!NILP (w->buffer)); 13045 xassert (!NILP (w->buffer));
13031 #if GLYPH_DEBUG 13046 #if GLYPH_DEBUG
13032 *w->desired_matrix->method = 0; 13047 *w->desired_matrix->method = 0;
13033 #endif 13048 #endif
13034 13049
13035 specbind (Qinhibit_point_motion_hooks, Qt); 13050 restart:
13036
13037 reconsider_clip_changes (w, buffer); 13051 reconsider_clip_changes (w, buffer);
13038 13052
13039 /* Has the mode line to be updated? */ 13053 /* Has the mode line to be updated? */
13040 update_mode_line = (!NILP (w->update_mode_line) 13054 update_mode_line = (!NILP (w->update_mode_line)
13041 || update_mode_lines 13055 || update_mode_lines
13082 /* Otherwise set up data on this window; select its buffer and point 13096 /* Otherwise set up data on this window; select its buffer and point
13083 value. */ 13097 value. */
13084 /* Really select the buffer, for the sake of buffer-local 13098 /* Really select the buffer, for the sake of buffer-local
13085 variables. */ 13099 variables. */
13086 set_buffer_internal_1 (XBUFFER (w->buffer)); 13100 set_buffer_internal_1 (XBUFFER (w->buffer));
13087 SET_TEXT_POS (opoint, PT, PT_BYTE);
13088
13089 beg_unchanged = BEG_UNCHANGED;
13090 end_unchanged = END_UNCHANGED;
13091 13101
13092 current_matrix_up_to_date_p 13102 current_matrix_up_to_date_p
13093 = (!NILP (w->window_end_valid) 13103 = (!NILP (w->window_end_valid)
13094 && !current_buffer->clip_changed 13104 && !current_buffer->clip_changed
13095 && !current_buffer->prevent_redisplay_optimizations_p 13105 && !current_buffer->prevent_redisplay_optimizations_p
13096 && XFASTINT (w->last_modified) >= MODIFF 13106 && XFASTINT (w->last_modified) >= MODIFF
13097 && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF); 13107 && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF);
13108
13109 /* Run the window-bottom-change-functions
13110 if it is possible that the text on the screen has changed
13111 (either due to modification of the text, or any other reason). */
13112 if (!current_matrix_up_to_date_p
13113 && !NILP (Vwindow_text_change_functions))
13114 {
13115 safe_run_hooks (Qwindow_text_change_functions);
13116 goto restart;
13117 }
13118
13119 beg_unchanged = BEG_UNCHANGED;
13120 end_unchanged = END_UNCHANGED;
13121
13122 SET_TEXT_POS (opoint, PT, PT_BYTE);
13123
13124 specbind (Qinhibit_point_motion_hooks, Qt);
13098 13125
13099 buffer_unchanged_p 13126 buffer_unchanged_p
13100 = (!NILP (w->window_end_valid) 13127 = (!NILP (w->window_end_valid)
13101 && !current_buffer->clip_changed 13128 && !current_buffer->clip_changed
13102 && XFASTINT (w->last_modified) >= MODIFF 13129 && XFASTINT (w->last_modified) >= MODIFF
24285 staticpro (&Qoverriding_local_map); 24312 staticpro (&Qoverriding_local_map);
24286 Qoverriding_local_map = intern ("overriding-local-map"); 24313 Qoverriding_local_map = intern ("overriding-local-map");
24287 24314
24288 staticpro (&Qwindow_scroll_functions); 24315 staticpro (&Qwindow_scroll_functions);
24289 Qwindow_scroll_functions = intern ("window-scroll-functions"); 24316 Qwindow_scroll_functions = intern ("window-scroll-functions");
24317
24318 staticpro (&Qwindow_text_change_functions);
24319 Qwindow_text_change_functions = intern ("window-text-change-functions");
24290 24320
24291 staticpro (&Qredisplay_end_trigger_functions); 24321 staticpro (&Qredisplay_end_trigger_functions);
24292 Qredisplay_end_trigger_functions = intern ("redisplay-end-trigger-functions"); 24322 Qredisplay_end_trigger_functions = intern ("redisplay-end-trigger-functions");
24293 24323
24294 staticpro (&Qinhibit_point_motion_hooks); 24324 staticpro (&Qinhibit_point_motion_hooks);
24597 Each function is called with two arguments, the window 24627 Each function is called with two arguments, the window
24598 and its new display-start position. Note that the value of `window-end' 24628 and its new display-start position. Note that the value of `window-end'
24599 is not valid when these functions are called. */); 24629 is not valid when these functions are called. */);
24600 Vwindow_scroll_functions = Qnil; 24630 Vwindow_scroll_functions = Qnil;
24601 24631
24632 DEFVAR_LISP ("window-text-change-functions",
24633 &Vwindow_text_change_functions,
24634 doc: /* Functions to call in redisplay when text in the window might change. */);
24635 Vwindow_text_change_functions = Qnil;
24636
24602 DEFVAR_LISP ("redisplay-end-trigger-functions", &Vredisplay_end_trigger_functions, 24637 DEFVAR_LISP ("redisplay-end-trigger-functions", &Vredisplay_end_trigger_functions,
24603 doc: /* Functions called when redisplay of a window reaches the end trigger. 24638 doc: /* Functions called when redisplay of a window reaches the end trigger.
24604 Each function is called with two arguments, the window and the end trigger value. 24639 Each function is called with two arguments, the window and the end trigger value.
24605 See `set-window-redisplay-end-trigger'. */); 24640 See `set-window-redisplay-end-trigger'. */);
24606 Vredisplay_end_trigger_functions = Qnil; 24641 Vredisplay_end_trigger_functions = Qnil;
24706 Vblink_cursor_alist = Qnil; 24741 Vblink_cursor_alist = Qnil;
24707 24742
24708 DEFVAR_BOOL ("auto-hscroll-mode", &automatic_hscrolling_p, 24743 DEFVAR_BOOL ("auto-hscroll-mode", &automatic_hscrolling_p,
24709 doc: /* *Non-nil means scroll the display automatically to make point visible. */); 24744 doc: /* *Non-nil means scroll the display automatically to make point visible. */);
24710 automatic_hscrolling_p = 1; 24745 automatic_hscrolling_p = 1;
24746 Qauto_hscroll_mode = intern ("auto-hscroll-mode");
24747 staticpro (&Qauto_hscroll_mode);
24711 24748
24712 DEFVAR_INT ("hscroll-margin", &hscroll_margin, 24749 DEFVAR_INT ("hscroll-margin", &hscroll_margin,
24713 doc: /* *How many columns away from the window edge point is allowed to get 24750 doc: /* *How many columns away from the window edge point is allowed to get
24714 before automatic hscrolling will horizontally scroll the window. */); 24751 before automatic hscrolling will horizontally scroll the window. */);
24715 hscroll_margin = 5; 24752 hscroll_margin = 5;