else
w->last_point = marker_position (w->pointm);
- w->window_end_valid = true;
+ /* w->last_mark is recorded for text conversion purposes.
+ Input methods aren't interested in the value of the mark
+ if it is inactive, so set it to -1 if it's not. */
+
+ if (XMARKER (BVAR (b, mark))->buffer == b
+ && !NILP (BVAR (b, mark_active)))
+ w->last_mark = marker_position (BVAR (b, mark));
+ else
+ w->last_mark = -1;
+
+#ifdef HAVE_TEXT_CONVERSION
+ /* See the description of this field in struct window. */
+ w->ephemeral_last_point = w->last_point;
+
+ /* Point motion is only propagated to the input method for use
+ in text conversion during a redisplay. While this can lead
+ to inconsistencies when point has moved but the change has
+ not yet been displayed, it leads to better results most of
+ the time, as point often changes within calls to
+ `save-excursion', and the only way to detect such calls is to
+ observe that the next redisplay never ends with those changes
+ applied.
+
+ Changes to buffer text are immediately propagated to the
+ input method, and the position of point is also updated
+ during such a change, so the consequences are not that
+ severe. */
+
+ if ((prev_point != w->last_point
+ || prev_mark != w->last_mark)
+ && FRAME_WINDOW_P (WINDOW_XFRAME (w))
+ && w == XWINDOW (WINDOW_XFRAME (w)->selected_window))
+ report_point_change (WINDOW_XFRAME (w), w, b);
+#endif /* HAVE_TEXT_CONVERSION */
+
+ struct glyph_row *row;
+ /* These conditions should be consistent with CHECK_WINDOW_END. */
+ if (w->window_end_vpos < w->current_matrix->nrows
+ && ((row = MATRIX_ROW (w->current_matrix, w->window_end_vpos),
+ !row->enabled_p
+ || MATRIX_ROW_DISPLAYS_TEXT_P (row)
+ || MATRIX_ROW_VPOS (row, w->current_matrix) == 0)))
+ w->window_end_valid = true;
w->update_mode_line = false;
w->preserve_vscroll_p = false;
}