aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c84
1 files changed, 78 insertions, 6 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 2b93311023d..ba33e111387 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -427,6 +427,14 @@ redisplay ()
427 || ! EQ (Voverlay_arrow_string, last_arrow_string)) 427 || ! EQ (Voverlay_arrow_string, last_arrow_string))
428 all_windows = 1, clip_changed = 1; 428 all_windows = 1, clip_changed = 1;
429 429
430 /* If showing region, and mark has changed, must redisplay whole window. */
431 if (((!NILP (Vtransient_mark_mode)
432 && !NILP (XBUFFER (w->buffer)->mark_active))
433 != !NILP (w->region_showing))
434 || !EQ (w->region_showing,
435 Fmarker_position (XBUFFER (w->buffer)->mark)))
436 this_line_bufpos = -1;
437
430 tlbufpos = this_line_bufpos; 438 tlbufpos = this_line_bufpos;
431 tlendpos = this_line_endpos; 439 tlendpos = this_line_endpos;
432 if (!all_windows && tlbufpos > 0 && NILP (w->update_mode_line) 440 if (!all_windows && tlbufpos > 0 && NILP (w->update_mode_line)
@@ -486,7 +494,10 @@ redisplay ()
486 } 494 }
487 goto update; 495 goto update;
488 } 496 }
489 else 497 /* If highlighting the region, we can't just move the cursor. */
498 else if (! (!NILP (Vtransient_mark_mode)
499 && !NILP (current_buffer->mark_active))
500 && NILP (w->region_showing))
490 { 501 {
491 pos = *compute_motion (tlbufpos, 0, 502 pos = *compute_motion (tlbufpos, 0,
492 XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0, 503 XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0,
@@ -699,10 +710,20 @@ mark_window_display_accurate (window, flag)
699 w = XWINDOW (window); 710 w = XWINDOW (window);
700 711
701 if (!NILP (w->buffer)) 712 if (!NILP (w->buffer))
702 XFASTINT (w->last_modified) 713 {
703 = !flag ? 0 714 XFASTINT (w->last_modified)
704 : XBUFFER (w->buffer) == current_buffer 715 = !flag ? 0
705 ? MODIFF : BUF_MODIFF (XBUFFER (w->buffer)); 716 : XBUFFER (w->buffer) == current_buffer
717 ? MODIFF : BUF_MODIFF (XBUFFER (w->buffer));
718
719 /* Record if we are showing a region, so can make sure to
720 update it fully at next redisplay. */
721 w->region_showing = (!NILP (Vtransient_mark_mode)
722 && !NILP (XBUFFER (w->buffer)->mark_active)
723 ? Fmarker_position (XBUFFER (w->buffer)->mark)
724 : Qnil);
725 }
726
706 w->window_end_valid = Qt; 727 w->window_end_valid = Qt;
707 w->update_mode_line = Qnil; 728 w->update_mode_line = Qnil;
708 729
@@ -849,6 +870,7 @@ redisplay_window (window, just_this_one)
849 try_window (window, startp); 870 try_window (window, startp);
850 if (cursor_vpos < 0) 871 if (cursor_vpos < 0)
851 { 872 {
873 /* ??? What should happen here if highlighting a region? */
852 /* If point does not appear, move point so it does appear */ 874 /* If point does not appear, move point so it does appear */
853 pos = *compute_motion (startp, 0, 875 pos = *compute_motion (startp, 0,
854 ((EQ (window, minibuf_window) && startp == 1) 876 ((EQ (window, minibuf_window) && startp == 1)
@@ -884,6 +906,9 @@ redisplay_window (window, just_this_one)
884 if (XFASTINT (w->last_modified) >= MODIFF 906 if (XFASTINT (w->last_modified) >= MODIFF
885 && point >= startp && !clip_changed 907 && point >= startp && !clip_changed
886 && (just_this_one || XFASTINT (w->width) == FRAME_WIDTH (f)) 908 && (just_this_one || XFASTINT (w->width) == FRAME_WIDTH (f))
909 /* Can't use this case if highlighting a region. */
910 && !(!NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active))
911 && NILP (w->region_showing)
887 && !EQ (window, minibuf_window)) 912 && !EQ (window, minibuf_window))
888 { 913 {
889 pos = *compute_motion (startp, 0, (hscroll ? 1 - hscroll : 0), 914 pos = *compute_motion (startp, 0, (hscroll ? 1 - hscroll : 0),
@@ -926,6 +951,10 @@ redisplay_window (window, just_this_one)
926 && do_id && !clip_changed 951 && do_id && !clip_changed
927 && !blank_end_of_window 952 && !blank_end_of_window
928 && XFASTINT (w->width) == FRAME_WIDTH (f) 953 && XFASTINT (w->width) == FRAME_WIDTH (f)
954 /* Can't use this case if highlighting a region. */
955 && !(!NILP (Vtransient_mark_mode)
956 && !NILP (current_buffer->mark_active))
957 && NILP (w->region_showing)
929 && EQ (last_arrow_position, Voverlay_arrow_position) 958 && EQ (last_arrow_position, Voverlay_arrow_position)
930 && EQ (last_arrow_string, Voverlay_arrow_string) 959 && EQ (last_arrow_string, Voverlay_arrow_string)
931 && (tem = try_window_id (FRAME_SELECTED_WINDOW (f))) 960 && (tem = try_window_id (FRAME_SELECTED_WINDOW (f)))
@@ -1638,6 +1667,12 @@ display_text_line (w, start, vpos, hpos, taboffset)
1638 || (truncate_partial_width_windows 1667 || (truncate_partial_width_windows
1639 && XFASTINT (w->width) < FRAME_WIDTH (f)) 1668 && XFASTINT (w->width) < FRAME_WIDTH (f))
1640 || !NILP (current_buffer->truncate_lines); 1669 || !NILP (current_buffer->truncate_lines);
1670
1671 /* 1 if we should highlight the region. */
1672 int highlight_region
1673 = !NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active);
1674 int region_beg, region_end;
1675
1641 int selective 1676 int selective
1642 = XTYPE (current_buffer->selective_display) == Lisp_Int 1677 = XTYPE (current_buffer->selective_display) == Lisp_Int
1643 ? XINT (current_buffer->selective_display) 1678 ? XINT (current_buffer->selective_display)
@@ -1679,6 +1714,22 @@ display_text_line (w, start, vpos, hpos, taboffset)
1679 get_display_line (f, vpos, XFASTINT (w->left)); 1714 get_display_line (f, vpos, XFASTINT (w->left));
1680 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; 1715 if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
1681 1716
1717 /* Show where to highlight the region. */
1718 if (highlight_region && XMARKER (current_buffer->mark)->buffer != 0)
1719 {
1720 region_beg = marker_position (current_buffer->mark);
1721 if (PT < region_beg)
1722 {
1723 region_end = region_beg;
1724 region_beg = PT;
1725 }
1726 else
1727 region_end = PT;
1728 w->region_showing = Qt;
1729 }
1730 else
1731 region_beg = region_end = -1;
1732
1682 if (MINI_WINDOW_P (w) && start == 1 1733 if (MINI_WINDOW_P (w) && start == 1
1683 && vpos == XFASTINT (w->top)) 1734 && vpos == XFASTINT (w->top))
1684 { 1735 {
@@ -1730,7 +1781,9 @@ display_text_line (w, start, vpos, hpos, taboffset)
1730 use now. We also hit this the first time through the 1781 use now. We also hit this the first time through the
1731 loop, to see what face we should start with. */ 1782 loop, to see what face we should start with. */
1732 if (pos == next_face_change) 1783 if (pos == next_face_change)
1733 current_face = compute_char_face (f, w, pos, &next_face_change); 1784 current_face = compute_char_face (f, w, pos,
1785 region_beg, region_end,
1786 &next_face_change);
1734#endif 1787#endif
1735 1788
1736 pause = end; 1789 pause = end;
@@ -2002,6 +2055,25 @@ display_menu_bar (w)
2002 2055
2003 get_display_line (f, vpos, 0); 2056 get_display_line (f, vpos, 0);
2004 2057
2058 /* If the user has switched buffers or windows, we need to
2059 recompute to reflect the new bindings. But we'll
2060 recompute when update_mode_lines is set too; that means
2061 that people can use force-mode-line-update to request
2062 that the menu bar be recomputed. The adverse effect on
2063 the rest of the redisplay algorithm is about the same as
2064 windows_or_buffers_changed anyway. */
2065 if (windows_or_buffers_changed
2066 || update_mode_lines
2067 || (XFASTINT (w->last_modified) < MODIFF
2068 && (XFASTINT (w->last_modified)
2069 <= XBUFFER (w->buffer)->save_modified)))
2070 {
2071 struct buffer *prev = current_buffer;
2072 current_buffer = XBUFFER (w->buffer);
2073 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items ();
2074 current_buffer = prev;
2075 }
2076
2005 for (tail = FRAME_MENU_BAR_ITEMS (f); CONSP (tail); tail = XCONS (tail)->cdr) 2077 for (tail = FRAME_MENU_BAR_ITEMS (f); CONSP (tail); tail = XCONS (tail)->cdr)
2006 { 2078 {
2007 Lisp_Object string; 2079 Lisp_Object string;