+2013-02-04 Eli Zaretskii <eliz@gnu.org>
+
+ * xdisp.c (window_buffer_changed): region_showing can be negative,
+ which still means region is being displayed.
+ (redisplay_internal): Resurrect code that forced redisplay of the
+ whole window when showing region and the mark has changed. Record
+ the new mark position to allow redisplay optimizations.
+ (display_line): If it->region_beg_charpos is non-zero, set the
+ window's region_showing member to -1. (Bug#13623) (Bug#13626)
+
+ * window.h (struct window) <region_showing>: Declare ptrdiff_t,
+ not bitfield of 1 bit.
+
2013-02-03 Daniel Colascione <dancol@dancol.org>
* emacs.c: Use execvp, not execv, when DAEMON_MUST_EXEC, so that
the frame image that window_end_pos did not get onto the frame. */
unsigned window_end_valid : 1;
- /* Nonzero if we have highlighted the region (or any part of it). */
- unsigned region_showing : 1;
-
/* Amount by which lines of this window are scrolled in
y-direction (smooth scrolling). */
int vscroll;
+ /* If we have highlighted the region (or any part of it), the mark
+ position or -1 (the latter is used by the iterator for internal
+ purposes); otherwise zero. */
+ ptrdiff_t region_showing;
+
/* Z_BYTE - buffer position of the last glyph in the current matrix of W.
Should be nonnegative, and only valid if window_end_valid is nonzero. */
ptrdiff_t window_end_bytepos;
return (((BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star)
|| ((!NILP (Vtransient_mark_mode) && !NILP (BVAR (b, mark_active)))
- != w->region_showing));
+ != (w->region_showing != 0)));
}
/* Nonzero if W has %c in its mode line and mode line should be updated. */
clear_garbaged_frames ();
}
+ /* If showing the region, and mark has changed, we must redisplay
+ the whole window. The assignment to this_line_start_pos prevents
+ the optimization directly below this if-statement. */
+ if (((!NILP (Vtransient_mark_mode)
+ && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
+ != (w->region_showing > 0))
+ || (w->region_showing
+ && w->region_showing
+ != XINT (Fmarker_position (BVAR (XBUFFER (w->buffer), mark)))))
+ CHARPOS (this_line_start_pos) = 0;
+
/* Optimize the case that only the line containing the cursor in the
selected window has changed. Variables starting with this_ are
set in display_line and record information about the line
++clear_image_cache_count;
#endif
+ w->region_showing = XINT (Fmarker_position (BVAR (XBUFFER (w->buffer), mark)));
+
/* Build desired matrices, and update the display. If
consider_all_windows_p is non-zero, do it for all windows on all
frames. Otherwise do it for selected_window, only. */
}
/* Is IT->w showing the region? */
- it->w->region_showing = it->region_beg_charpos > 0;
+ it->w->region_showing = it->region_beg_charpos > 0 ? -1 : 0;
/* Clear the result glyph row and enable it. */
prepare_desired_row (row);