free realized faces now because they depend on face definitions
that might have changed. Don't free faces while there might be
desired matrices pending which reference these faces. */
- if (face_change_count && !inhibit_free_realized_faces)
+ if (face_change && !inhibit_free_realized_faces)
{
- face_change_count = 0;
+ face_change = false;
free_all_realized_faces (Qnil);
}
row = MATRIX_HEADER_LINE_ROW (w->desired_matrix);
}
- /* Clear IT. */
-
- /* The code assumes it->object and other Lisp_Object components are
- set to nil, so verify that memset does this. */
- verify (NIL_IS_ZERO);
- memset (it, 0, sizeof *it);
-
+ /* Clear IT, and set it->object and other IT's Lisp objects to Qnil.
+ Other parts of redisplay rely on that. */
+ memclear (it, sizeof *it);
it->current.overlay_string_index = -1;
it->current.dpvec_index = -1;
it->base_face_id = remapped_base_face_id;
&next_stop,
(IT_CHARPOS (*it)
+ TEXT_PROP_DISTANCE_LIMIT),
- 0, it->base_face_id);
+ false, it->base_face_id);
/* Is this a start of a run of characters with box face?
Caveat: this can be called for a freshly initialized
&next_stop,
(IT_CHARPOS (*it)
+ TEXT_PROP_DISTANCE_LIMIT),
- 0,
+ false,
from_overlay);
}
else
IT_STRING_CHARPOS (*it),
bufpos,
&next_stop,
- base_face_id, 0);
+ base_face_id, false);
/* Is this a start of a run of characters with box? Caveat:
this can be called for a freshly allocated iterator; face_id
charpos,
bufpos,
&next_check_charpos,
- base_face_id, 0);
+ base_face_id, false);
/* Correct the face for charsets different from ASCII. Do it
for the multibyte case only. The face returned above is
face_id = face_at_buffer_position (it->w,
CHARPOS (pos),
&next_check_charpos,
- limit, 0, -1);
+ limit, false, -1);
/* Correct the face for charsets different from ASCII. Do it
for the multibyte case only. The face returned above is
#endif /* not HAVE_WINDOW_SYSTEM */
|| (CONSP (value) && EQ (XCAR (value), Qspace))
#ifdef HAVE_XWIDGETS
- || valid_xwidget_spec_p(value)
+ || ((it ? FRAME_WINDOW_P (it->f) : frame_window_p)
+ && valid_xwidget_spec_p(value))
#endif
);
{
next_face_id = face_at_buffer_position
(it->w, CHARPOS (pos), &ignore,
- CHARPOS (pos) + TEXT_PROP_DISTANCE_LIMIT, 0, -1);
+ CHARPOS (pos) + TEXT_PROP_DISTANCE_LIMIT, false, -1);
it->end_of_box_run_p
= (FACE_FROM_ID (it->f, next_face_id)->box
== FACE_NO_BOX);
static void
run_redisplay_end_trigger_hook (struct it *it)
{
- Lisp_Object args[3];
-
/* IT->glyph_row should be non-null, i.e. we should be actually
displaying something, or otherwise we should not run the hook. */
eassert (it->glyph_row);
- /* Set up hook arguments. */
- args[0] = Qredisplay_end_trigger_functions;
- args[1] = it->window;
- XSETINT (args[2], it->redisplay_end_trigger_charpos);
+ ptrdiff_t charpos = it->redisplay_end_trigger_charpos;
it->redisplay_end_trigger_charpos = 0;
/* Since we are *trying* to run these functions, don't try to run
them again, even if they get an error. */
wset_redisplay_end_trigger (it->w, Qnil);
- Frun_hook_with_args (3, args);
+ CALLN (Frun_hook_with_args, Qredisplay_end_trigger_functions, it->window,
+ make_number (charpos));
/* Notice if it changed the face of the character we are on. */
handle_face_prop (it);
&& it->current_x == it->last_visible_x - 1
&& it->c != '\n'
&& it->c != '\t'
+ && it->w->window_end_valid
&& it->vpos < it->w->window_end_vpos)
{
it->continuation_lines_width += it->current_x;
void
add_to_log (const char *format, Lisp_Object arg1, Lisp_Object arg2)
{
- Lisp_Object args[3];
Lisp_Object msg, fmt;
char *buffer;
ptrdiff_t len;
fmt = msg = Qnil;
GCPRO4 (fmt, msg, arg1, arg2);
- args[0] = fmt = build_string (format);
- args[1] = arg1;
- args[2] = arg2;
- msg = Fformat (3, args);
+ fmt = build_string (format);
+ msg = CALLN (Fformat, fmt, arg1, arg2);
len = SBYTES (msg) + 1;
buffer = SAFE_ALLOCA (len);
initialized yet, just toss it. */
if (f->glyphs_initialized_p)
{
- Lisp_Object args[2], msg;
struct gcpro gcpro1, gcpro2;
- args[0] = build_string (m);
- args[1] = msg = string;
- GCPRO2 (args[0], msg);
- gcpro1.nvars = 2;
+ Lisp_Object fmt = build_string (m);
+ Lisp_Object msg = string;
+ GCPRO2 (fmt, msg);
- msg = Fformat (2, args);
+ msg = CALLN (Fformat, fmt, msg);
if (log)
message3 (msg);
last_glyphless_glyph_frame = NULL;
last_glyphless_glyph_face_id = (1 << FACE_ID_BITS);
- /* If face_change_count is non-zero, init_iterator will free all
- realized faces, which includes the faces referenced from current
- matrices. So, we can't reuse current matrices in this case. */
- if (face_change_count)
+ /* If face_change, init_iterator will free all realized faces, which
+ includes the faces referenced from current matrices. So, we
+ can't reuse current matrices in this case. */
+ if (face_change)
windows_or_buffers_changed = 47;
if ((FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf))
/* Likewise there was a check whether window_end_vpos is nil or larger
than the window. Now window_end_vpos is int and so never nil, but
let's leave eassert to check whether it fits in the window. */
- eassert (w->window_end_vpos < w->current_matrix->nrows);
+ eassert (!w->window_end_valid
+ || w->window_end_vpos < w->current_matrix->nrows);
/* Handle case where text has not changed, only point, and it has
not moved off the frame. */
if (f->fonts_changed)
return -1;
+ /* The redisplay iterations in display_line above could have
+ triggered font-lock, which could have done something that
+ invalidates IT->w window's end-point information, on which we
+ rely below. E.g., one package, which will remain unnamed, used
+ to install a font-lock-fontify-region-function that called
+ bury-buffer, whose side effect is to switch the buffer displayed
+ by IT->w, and that predictably resets IT->w's window_end_valid
+ flag, which we already tested at the entry to this function.
+ Amply punish such packages/modes by giving up on this
+ optimization in those cases. */
+ if (!w->window_end_valid)
+ {
+ clear_glyph_matrix (w->desired_matrix);
+ return -1;
+ }
/* Compute differences in buffer positions, y-positions etc. for
lines reused at the bottom of the window. Compute what we can
&& glyph->u.ch == ' '))
&& trailing_whitespace_p (glyph->charpos))
{
- int face_id = lookup_named_face (f, Qtrailing_whitespace, 0);
+ int face_id = lookup_named_face (f, Qtrailing_whitespace, false);
if (face_id < 0)
return;
it->face_id
= face_at_string_position (it->w, face_string, face_string_pos,
- 0, &endptr, it->base_face_id, 0);
+ 0, &endptr, it->base_face_id, false);
face = FACE_FROM_ID (it->f, it->face_id);
it->face_box_p = face->box != FACE_NO_BOX;
}
enum glyph_row_area area = it->area;
glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
+ if (it->glyph_row->reversed_p)
+ {
+ struct glyph *g;
+
+ /* Make room for the new glyph. */
+ for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--)
+ g[1] = *g;
+ glyph = it->glyph_row->glyphs[it->area];
+ }
if (glyph < it->glyph_row->glyphs[area + 1])
{
glyph->charpos = CHARPOS (it->position);
int face_id;
struct face *face;
- face_id = lookup_named_face (it->f, face_name, 0);
+ face_id = lookup_named_face (it->f, face_name, false);
if (face_id < 0)
return make_number (-1);
charpos,
0, &ignore,
glyph->face_id,
- 1);
+ true);
show_mouse_face (hlinfo, DRAW_MOUSE_FACE);
if (NILP (pointer))
hlinfo->mouse_face_window = window;
hlinfo->mouse_face_face_id
= face_at_string_position (w, object, pos, 0, &ignore,
- glyph->face_id, 1);
+ glyph->face_id, true);
show_mouse_face (hlinfo, DRAW_MOUSE_FACE);
cursor = No_Cursor;
}