summaryrefslogtreecommitdiff
path: root/src/xdisp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xdisp.c')
-rw-r--r--src/xdisp.c451
1 files changed, 234 insertions, 217 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index a5bba1a81cd..5ae15cbd0b3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -580,7 +580,7 @@ static struct glyph scratch_glyphs[MAX_SCRATCH_GLYPHS];
/* Ascent and height of the last line processed by move_it_to. */
-static int last_max_ascent, last_height;
+static int last_height;
/* Non-zero if there's a help-echo in the echo area. */
@@ -794,6 +794,7 @@ static void set_iterator_to_next (struct it *, int);
static void mark_window_display_accurate_1 (struct window *, int);
static int single_display_spec_string_p (Lisp_Object, Lisp_Object);
static int display_prop_string_p (Lisp_Object, Lisp_Object);
+static int row_for_charpos_p (struct glyph_row *, ptrdiff_t);
static int cursor_row_p (struct glyph_row *);
static int redisplay_mode_lines (Lisp_Object, int);
static char *decode_mode_spec_coding (Lisp_Object, char *, int);
@@ -880,7 +881,6 @@ static void next_overlay_string (struct it *);
static void reseat (struct it *, struct text_pos, int);
static void reseat_1 (struct it *, struct text_pos, int);
static void back_to_previous_visible_line_start (struct it *);
-void reseat_at_previous_visible_line_start (struct it *);
static void reseat_at_next_visible_line_start (struct it *, int);
static int next_element_from_ellipsis (struct it *);
static int next_element_from_display_vector (struct it *);
@@ -899,7 +899,6 @@ static int get_next_display_element (struct it *);
static enum move_it_result
move_it_in_display_line_to (struct it *, ptrdiff_t, int,
enum move_operation_enum);
-void move_it_vertically_backward (struct it *, int);
static void get_visually_first_element (struct it *);
static void init_to_row_start (struct it *, struct window *,
struct glyph_row *);
@@ -979,7 +978,7 @@ window_text_bottom_y (struct window *w)
int
window_box_width (struct window *w, int area)
{
- int cols = XFASTINT (w->total_cols);
+ int cols = w->total_cols;
int pixels = 0;
if (!w->pseudo_window_p)
@@ -1283,10 +1282,10 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
if (FRAME_INITIAL_P (XFRAME (WINDOW_FRAME (w))))
return visible_p;
- if (XBUFFER (w->buffer) != current_buffer)
+ if (XBUFFER (w->contents) != current_buffer)
{
old_buffer = current_buffer;
- set_buffer_internal_1 (XBUFFER (w->buffer));
+ set_buffer_internal_1 (XBUFFER (w->contents));
}
SET_TEXT_POS_FROM_MARKER (top, w->start);
@@ -1372,18 +1371,41 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
top_x = it.glyph_row->x;
else
{
- struct it it2;
+ struct it it2, it2_prev;
+ /* The idea is to get to the previous buffer
+ position, consume the character there, and use
+ the pixel coordinates we get after that. But if
+ the previous buffer position is also displayed
+ from a display vector, we need to consume all of
+ the glyphs from that display vector. */
start_display (&it2, w, top);
move_it_to (&it2, charpos - 1, -1, -1, -1, MOVE_TO_POS);
- get_next_display_element (&it2);
- PRODUCE_GLYPHS (&it2);
- if (ITERATOR_AT_END_OF_LINE_P (&it2)
- || it2.current_x > it2.last_visible_x)
+ /* If we didn't get to CHARPOS - 1, there's some
+ replacing display property at that position, and
+ we stopped after it. That is exactly the place
+ whose coordinates we want. */
+ if (IT_CHARPOS (it2) != charpos - 1)
+ it2_prev = it2;
+ else
+ {
+ /* Iterate until we get out of the display
+ vector that displays the character at
+ CHARPOS - 1. */
+ do {
+ get_next_display_element (&it2);
+ PRODUCE_GLYPHS (&it2);
+ it2_prev = it2;
+ set_iterator_to_next (&it2, 1);
+ } while (it2.method == GET_FROM_DISPLAY_VECTOR
+ && IT_CHARPOS (it2) < charpos);
+ }
+ if (ITERATOR_AT_END_OF_LINE_P (&it2_prev)
+ || it2_prev.current_x > it2_prev.last_visible_x)
top_x = it.glyph_row->x;
else
{
- top_x = it2.current_x;
- top_y = it2.current_y;
+ top_x = it2_prev.current_x;
+ top_y = it2_prev.current_y;
}
}
}
@@ -1392,23 +1414,34 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
Lisp_Object cpos = make_number (charpos);
Lisp_Object spec = Fget_char_property (cpos, Qdisplay, Qnil);
Lisp_Object string = string_from_display_spec (spec);
+ struct text_pos tpos;
+ int replacing_spec_p;
bool newline_in_string
= (STRINGP (string)
&& memchr (SDATA (string), '\n', SBYTES (string)));
+
+ SET_TEXT_POS (tpos, charpos, CHAR_TO_BYTE (charpos));
+ replacing_spec_p
+ = (!NILP (spec)
+ && handle_display_spec (NULL, spec, Qnil, Qnil, &tpos,
+ charpos, FRAME_WINDOW_P (it.f)));
/* The tricky code below is needed because there's a
discrepancy between move_it_to and how we set cursor
- when the display line ends in a newline from a
- display string. move_it_to will stop _after_ such
- display strings, whereas set_cursor_from_row
- conspires with cursor_row_p to place the cursor on
- the first glyph produced from the display string. */
+ when PT is at the beginning of a portion of text
+ covered by a display property or an overlay with a
+ display property, or the display line ends in a
+ newline from a display string. move_it_to will stop
+ _after_ such display strings, whereas
+ set_cursor_from_row conspires with cursor_row_p to
+ place the cursor on the first glyph produced from the
+ display string. */
/* We have overshoot PT because it is covered by a
- display property whose value is a string. If the
- string includes embedded newlines, we are also in the
- wrong display line. Backtrack to the correct line,
- where the display string begins. */
- if (newline_in_string)
+ display property that replaces the text it covers.
+ If the string includes embedded newlines, we are also
+ in the wrong display line. Backtrack to the correct
+ line, where the display property begins. */
+ if (replacing_spec_p)
{
Lisp_Object startpos, endpos;
EMACS_INT start, end;
@@ -1434,7 +1467,8 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
rightmost character on a line that is
continued or word-wrapped. */
if (it3.method == GET_FROM_BUFFER
- && it3.c == '\n')
+ && (it3.c == '\n'
+ || FETCH_BYTE (IT_BYTEPOS (it3)) == '\n'))
move_it_by_lines (&it3, 1);
else if (move_it_in_display_line_to (&it3, -1,
it3.current_x
@@ -1502,6 +1536,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
produced from the string, until we find the
rightmost glyph not from the string. */
if (it3_moved
+ && newline_in_string
&& IT_CHARPOS (it3) != charpos && EQ (it3.object, string))
{
struct glyph *g = it3.glyph_row->glyphs[TEXT_AREA]
@@ -2677,7 +2712,7 @@ init_iterator (struct it *it, struct window *w,
and IT->region_end_charpos to the start and end of a visible region
in window IT->w. Set both to -1 to indicate no region. */
markpos = markpos_of_region ();
- if (0 <= markpos
+ if (markpos >= 0
/* Maybe highlight only in selected window. */
&& (/* Either show region everywhere. */
highlight_nonselected_windows
@@ -4458,7 +4493,7 @@ handle_display_prop (struct it *it)
if it was a text property. */
if (!STRINGP (it->string))
- object = it->w->buffer;
+ object = it->w->contents;
display_replaced_p = handle_display_spec (it, propval, object, overlay,
position, bufpos,
@@ -4866,7 +4901,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
it->what = IT_IMAGE;
it->image_id = -1; /* no image */
it->position = start_pos;
- it->object = NILP (object) ? it->w->buffer : object;
+ it->object = NILP (object) ? it->w->contents : object;
it->method = GET_FROM_IMAGE;
it->from_overlay = Qnil;
it->face_id = face_id;
@@ -5012,7 +5047,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
it->what = IT_IMAGE;
it->image_id = lookup_image (it->f, value);
it->position = start_pos;
- it->object = NILP (object) ? it->w->buffer : object;
+ it->object = NILP (object) ? it->w->contents : object;
it->method = GET_FROM_IMAGE;
/* Say that we haven't consumed the characters with
@@ -5836,7 +5871,7 @@ pop_it (struct it *it)
it->object = p->u.stretch.object;
break;
case GET_FROM_BUFFER:
- it->object = it->w->buffer;
+ it->object = it->w->contents;
break;
case GET_FROM_STRING:
it->object = it->string;
@@ -5849,7 +5884,7 @@ pop_it (struct it *it)
else
{
it->method = GET_FROM_BUFFER;
- it->object = it->w->buffer;
+ it->object = it->w->contents;
}
}
it->end_charpos = p->end_charpos;
@@ -6290,7 +6325,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p)
IT_STRING_BYTEPOS (*it) = -1;
it->string = Qnil;
it->method = GET_FROM_BUFFER;
- it->object = it->w->buffer;
+ it->object = it->w->contents;
it->area = TEXT_AREA;
it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
it->sp = 0;
@@ -7141,7 +7176,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
else
{
it->method = GET_FROM_BUFFER;
- it->object = it->w->buffer;
+ it->object = it->w->contents;
}
it->dpvec = NULL;
@@ -7153,6 +7188,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
else if (it->dpvec_char_len > 0)
{
if (it->method == GET_FROM_STRING
+ && it->current.overlay_string_index >= 0
&& it->n_overlay_strings > 0)
it->ignore_overlay_strings_at_pos_p = 1;
it->len = it->dpvec_char_len;
@@ -7714,7 +7750,7 @@ next_element_from_ellipsis (struct it *it)
setting face_before_selective_p. */
it->saved_face_id = it->face_id;
it->method = GET_FROM_BUFFER;
- it->object = it->w->buffer;
+ it->object = it->w->contents;
reseat_at_next_visible_line_start (it, 1);
it->face_before_selective_p = 1;
}
@@ -7978,7 +8014,7 @@ next_element_from_buffer (struct it *it)
/* Record what we have and where it came from. */
it->what = IT_CHARACTER;
- it->object = it->w->buffer;
+ it->object = it->w->contents;
it->position = it->current.pos;
/* Normally we return the character found above, except when we
@@ -8084,7 +8120,7 @@ next_element_from_composition (struct it *it)
return 0;
}
it->position = it->current.pos;
- it->object = it->w->buffer;
+ it->object = it->w->contents;
it->c = composition_update_it (&it->cmp_it, IT_CHARPOS (*it),
IT_BYTEPOS (*it), Qnil);
}
@@ -8925,7 +8961,6 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
it->current_y += it->max_ascent + it->max_descent;
++it->vpos;
last_height = it->max_ascent + it->max_descent;
- last_max_ascent = it->max_ascent;
it->max_ascent = it->max_descent = 0;
}
@@ -8952,7 +8987,6 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
it->current_y += it->max_ascent + it->max_descent;
++it->vpos;
last_height = it->max_ascent + it->max_descent;
- last_max_ascent = it->max_ascent;
}
if (backup_data)
@@ -9524,7 +9558,15 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
shown = buffer_window_count (current_buffer) > 0;
set_buffer_internal (oldbuf);
- if (!shown)
+ /* We called insert_1_both above with its 5th argument (PREPARE)
+ zero, which prevents insert_1_both from calling
+ prepare_to_modify_buffer, which in turns prevents us from
+ incrementing windows_or_buffers_changed even if *Messages* is
+ shown in some window. So we must manually incrementing
+ windows_or_buffers_changed here to make up for that. */
+ if (shown)
+ windows_or_buffers_changed++;
+ else
windows_or_buffers_changed = old_windows_or_buffers_changed;
message_log_need_newline = !nlflag;
Vdeactivate_mark = old_deactivate_mark;
@@ -9994,7 +10036,7 @@ with_echo_area_buffer_unwind_data (struct window *w)
Vwith_echo_area_save_vector = Qnil;
if (NILP (vector))
- vector = Fmake_vector (make_number (7), Qnil);
+ vector = Fmake_vector (make_number (9), Qnil);
XSETBUFFER (tmp, current_buffer); ASET (vector, i, tmp); ++i;
ASET (vector, i, Vdeactivate_mark); ++i;
@@ -10003,13 +10045,15 @@ with_echo_area_buffer_unwind_data (struct window *w)
if (w)
{
XSETWINDOW (tmp, w); ASET (vector, i, tmp); ++i;
- ASET (vector, i, w->buffer); ++i;
+ ASET (vector, i, w->contents); ++i;
ASET (vector, i, make_number (marker_position (w->pointm))); ++i;
ASET (vector, i, make_number (marker_byte_position (w->pointm))); ++i;
+ ASET (vector, i, make_number (marker_position (w->start))); ++i;
+ ASET (vector, i, make_number (marker_byte_position (w->start))); ++i;
}
else
{
- int end = i + 4;
+ int end = i + 6;
for (; i < end; ++i)
ASET (vector, i, Qnil);
}
@@ -10032,16 +10076,18 @@ unwind_with_echo_area_buffer (Lisp_Object vector)
if (WINDOWP (AREF (vector, 3)))
{
struct window *w;
- Lisp_Object buffer, charpos, bytepos;
+ Lisp_Object buffer;
w = XWINDOW (AREF (vector, 3));
buffer = AREF (vector, 4);
- charpos = AREF (vector, 5);
- bytepos = AREF (vector, 6);
wset_buffer (w, buffer);
set_marker_both (w->pointm, buffer,
- XFASTINT (charpos), XFASTINT (bytepos));
+ XFASTINT (AREF (vector, 5)),
+ XFASTINT (AREF (vector, 6)));
+ set_marker_both (w->start, buffer,
+ XFASTINT (AREF (vector, 7)),
+ XFASTINT (AREF (vector, 8)));
}
Vwith_echo_area_save_vector = vector;
@@ -10255,9 +10301,9 @@ resize_mini_window (struct window *w, int exact_p)
eassert (MINI_WINDOW_P (w));
/* By default, start display at the beginning. */
- set_marker_both (w->start, w->buffer,
- BUF_BEGV (XBUFFER (w->buffer)),
- BUF_BEGV_BYTE (XBUFFER (w->buffer)));
+ set_marker_both (w->start, w->contents,
+ BUF_BEGV (XBUFFER (w->contents)),
+ BUF_BEGV_BYTE (XBUFFER (w->contents)));
/* Don't resize windows while redisplaying a window; it would
confuse redisplay functions when the size of the window they are
@@ -10284,10 +10330,10 @@ resize_mini_window (struct window *w, int exact_p)
struct text_pos start;
struct buffer *old_current_buffer = NULL;
- if (current_buffer != XBUFFER (w->buffer))
+ if (current_buffer != XBUFFER (w->contents))
{
old_current_buffer = current_buffer;
- set_buffer_internal (XBUFFER (w->buffer));
+ set_buffer_internal (XBUFFER (w->contents));
}
init_iterator (&it, w, BEGV, BEGV_BYTE, NULL, DEFAULT_FACE_ID);
@@ -10736,7 +10782,7 @@ buffer_shared_and_changed (void)
/* Nonzero if W doesn't reflect the actual state of current buffer due
to its text or overlays change. FIXME: this may be called when
- XBUFFER (w->buffer) != current_buffer, which looks suspicious. */
+ XBUFFER (w->contents) != current_buffer, which looks suspicious. */
static int
window_outdated (struct window *w)
@@ -10751,7 +10797,7 @@ window_outdated (struct window *w)
static int
window_buffer_changed (struct window *w)
{
- struct buffer *b = XBUFFER (w->buffer);
+ struct buffer *b = XBUFFER (w->contents);
eassert (BUFFER_LIVE_P (b));
@@ -11005,7 +11051,7 @@ x_consider_frame_title (Lisp_Object frame)
Fselect_window (f->selected_window, Qt);
set_buffer_internal_1
- (XBUFFER (XWINDOW (f->selected_window)->buffer));
+ (XBUFFER (XWINDOW (f->selected_window)->contents));
fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format;
mode_line_target = MODE_LINE_TITLE;
@@ -11124,7 +11170,7 @@ prepare_menu_bars (void)
if (windows_or_buffers_changed
&& FRAME_NS_P (f))
ns_set_doc_edited
- (f, Fbuffer_modified_p (XWINDOW (f->selected_window)->buffer));
+ (f, Fbuffer_modified_p (XWINDOW (f->selected_window)->contents));
#endif
UNGCPRO;
}
@@ -11196,7 +11242,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
specbind (Qinhibit_menubar_update, Qt);
- set_buffer_internal_1 (XBUFFER (w->buffer));
+ set_buffer_internal_1 (XBUFFER (w->contents));
if (save_match_data)
record_unwind_save_match_data ();
if (NILP (Voverriding_local_map_menu_flag))
@@ -11400,7 +11446,7 @@ update_tool_bar (struct frame *f, int save_match_data)
/* Set current_buffer to the buffer of the selected
window of the frame, so that we get the right local
keymaps. */
- set_buffer_internal_1 (XBUFFER (w->buffer));
+ set_buffer_internal_1 (XBUFFER (w->contents));
/* Save match data, if we must. */
if (save_match_data)
@@ -12267,10 +12313,8 @@ hscroll_window_tree (Lisp_Object window)
{
struct window *w = XWINDOW (window);
- if (WINDOWP (w->hchild))
- hscrolled_p |= hscroll_window_tree (w->hchild);
- else if (WINDOWP (w->vchild))
- hscrolled_p |= hscroll_window_tree (w->vchild);
+ if (WINDOWP (w->contents))
+ hscrolled_p |= hscroll_window_tree (w->contents);
else if (w->cursor.vpos >= 0)
{
int h_margin;
@@ -12290,7 +12334,7 @@ hscroll_window_tree (Lisp_Object window)
/* Scroll when cursor is inside this scroll margin. */
h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w);
- if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->buffer))
+ if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->contents))
/* For left-to-right rows, hscroll when cursor is either
(i) inside the right hscroll margin, or (ii) if it is
inside the left margin and the window is already
@@ -12325,7 +12369,7 @@ hscroll_window_tree (Lisp_Object window)
/* Find point in a display of infinite width. */
saved_current_buffer = current_buffer;
- current_buffer = XBUFFER (w->buffer);
+ current_buffer = XBUFFER (w->contents);
if (w == XWINDOW (selected_window))
pt = PT;
@@ -12378,7 +12422,7 @@ hscroll_window_tree (Lisp_Object window)
redisplay. */
if (w->hscroll != hscroll)
{
- XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
+ XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1;
w->hscroll = hscroll;
hscrolled_p = 1;
}
@@ -12467,9 +12511,9 @@ debug_method_add (struct window *w, char const *fmt, ...)
if (trace_redisplay_p)
fprintf (stderr, "%p (%s): %s\n",
w,
- ((BUFFERP (w->buffer)
- && STRINGP (BVAR (XBUFFER (w->buffer), name)))
- ? SSDATA (BVAR (XBUFFER (w->buffer), name))
+ ((BUFFERP (w->contents)
+ && STRINGP (BVAR (XBUFFER (w->contents), name)))
+ ? SSDATA (BVAR (XBUFFER (w->contents), name))
: "no buffer"),
method + len);
}
@@ -12533,8 +12577,8 @@ text_outside_line_unchanged_p (struct window *w,
require to redisplay the whole paragraph. It might be worthwhile
to find the paragraph limits and widen the range of redisplayed
lines to that, but for now just give up this optimization. */
- if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))
- && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction)))
+ if (!NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering))
+ && NILP (BVAR (XBUFFER (w->contents), bidi_paragraph_direction)))
unchanged_p = 0;
}
@@ -12757,7 +12801,7 @@ reconsider_clip_changes (struct window *w, struct buffer *b)
we set b->clip_changed to 1 to force updating the screen. If
b->clip_changed has already been set to 1, we can skip this
check. */
- if (!b->clip_changed && BUFFERP (w->buffer) && w->window_end_valid)
+ if (!b->clip_changed && BUFFERP (w->contents) && w->window_end_valid)
{
ptrdiff_t pt;
@@ -12766,11 +12810,11 @@ reconsider_clip_changes (struct window *w, struct buffer *b)
else
pt = marker_position (w->pointm);
- if ((w->current_matrix->buffer != XBUFFER (w->buffer)
+ if ((w->current_matrix->buffer != XBUFFER (w->contents)
|| pt != w->last_point)
&& check_point_in_composition (w->current_matrix->buffer,
w->last_point,
- XBUFFER (w->buffer), pt))
+ XBUFFER (w->contents), pt))
b->clip_changed = 1;
}
}
@@ -12802,7 +12846,6 @@ redisplay_internal (void)
struct frame *sf;
int polling_stopped_here = 0;
Lisp_Object tail, frame;
- struct backtrace backtrace;
/* Non-zero means redisplay has to consider all windows on all
frames. Zero means, only selected_window is considered. */
@@ -12846,12 +12889,7 @@ redisplay_internal (void)
specbind (Qinhibit_free_realized_faces, Qnil);
/* Record this function, so it appears on the profiler's backtraces. */
- backtrace.next = backtrace_list;
- backtrace.function = Qredisplay_internal;
- backtrace.args = &Qnil;
- backtrace.nargs = 0;
- backtrace.debug_on_exit = 0;
- backtrace_list = &backtrace;
+ record_in_backtrace (Qredisplay_internal, &Qnil, 0);
FOR_EACH_FRAME (tail, frame)
XFRAME (frame)->already_hscrolled_p = 0;
@@ -12948,8 +12986,6 @@ redisplay_internal (void)
unbind_to (count1, Qnil);
- FRAME_SCROLL_BOTTOM_VPOS (XFRAME (w->frame)) = -1;
-
consider_all_windows_p = (update_mode_lines
|| buffer_shared_and_changed ()
|| cursor_type_changed);
@@ -13025,11 +13061,11 @@ redisplay_internal (void)
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)))
+ && !NILP (BVAR (XBUFFER (w->contents), mark_active)))
!= (w->region_showing > 0))
|| (w->region_showing
&& w->region_showing
- != XINT (Fmarker_position (BVAR (XBUFFER (w->buffer), mark)))))
+ != XINT (Fmarker_position (BVAR (XBUFFER (w->contents), mark)))))
CHARPOS (this_line_start_pos) = 0;
/* Optimize the case that only the line containing the cursor in the
@@ -13047,7 +13083,7 @@ redisplay_internal (void)
&& !FRAME_OBSCURED_P (XFRAME (w->frame))
/* Make sure recorded data applies to current buffer, etc. */
&& this_line_buffer == current_buffer
- && current_buffer == XBUFFER (w->buffer)
+ && current_buffer == XBUFFER (w->contents)
&& !w->force_start
&& !w->optional_new_start
/* Point must be on the line that we have info recorded about. */
@@ -13171,7 +13207,7 @@ redisplay_internal (void)
/* Make sure the cursor was last displayed
in this window. Otherwise we have to reposition it. */
&& 0 <= w->cursor.vpos
- && WINDOW_TOTAL_LINES (w) > w->cursor.vpos)
+ && w->cursor.vpos < WINDOW_TOTAL_LINES (w))
{
if (!must_finish)
{
@@ -13338,7 +13374,7 @@ redisplay_internal (void)
Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf);
struct frame *mini_frame;
- displayed_buffer = XBUFFER (XWINDOW (selected_window)->buffer);
+ displayed_buffer = XBUFFER (XWINDOW (selected_window)->contents);
/* Use list_of_error, not Qerror, so that
we catch only errors and don't run the debugger. */
internal_condition_case_1 (redisplay_window_1, selected_window,
@@ -13490,7 +13526,6 @@ redisplay_internal (void)
#endif /* HAVE_WINDOW_SYSTEM */
end_of_redisplay:
- backtrace_list = backtrace.next;
unbind_to (count, Qnil);
RESUME_POLLING;
}
@@ -13548,7 +13583,7 @@ unwind_redisplay (Lisp_Object old_frame)
static void
mark_window_display_accurate_1 (struct window *w, int accurate_p)
{
- struct buffer *b = XBUFFER (w->buffer);
+ struct buffer *b = XBUFFER (w->contents);
w->last_modified = accurate_p ? BUF_MODIFF (b) : 0;
w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF (b) : 0;
@@ -13595,11 +13630,9 @@ mark_window_display_accurate (Lisp_Object window, int accurate_p)
for (; !NILP (window); window = w->next)
{
w = XWINDOW (window);
- if (!NILP (w->vchild))
- mark_window_display_accurate (w->vchild, accurate_p);
- else if (!NILP (w->hchild))
- mark_window_display_accurate (w->hchild, accurate_p);
- else if (BUFFERP (w->buffer))
+ if (WINDOWP (w->contents))
+ mark_window_display_accurate (w->contents, accurate_p);
+ else
mark_window_display_accurate_1 (w, accurate_p);
}
@@ -13656,13 +13689,11 @@ redisplay_windows (Lisp_Object window)
{
struct window *w = XWINDOW (window);
- if (!NILP (w->hchild))
- redisplay_windows (w->hchild);
- else if (!NILP (w->vchild))
- redisplay_windows (w->vchild);
- else if (!NILP (w->buffer))
+ if (WINDOWP (w->contents))
+ redisplay_windows (w->contents);
+ else if (BUFFERP (w->contents))
{
- displayed_buffer = XBUFFER (w->buffer);
+ displayed_buffer = XBUFFER (w->contents);
/* Use list_of_error, not Qerror, so that
we catch only errors and don't run the debugger. */
internal_condition_case_1 (redisplay_window_0, window,
@@ -14309,7 +14340,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
&& !MATRIX_ROW_CONTINUATION_LINE_P (row)
&& row->x == 0)
{
- this_line_buffer = XBUFFER (w->buffer);
+ this_line_buffer = XBUFFER (w->contents);
CHARPOS (this_line_start_pos)
= MATRIX_ROW_START_CHARPOS (row) + delta;
@@ -14345,7 +14376,7 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp)
struct window *w = XWINDOW (window);
SET_MARKER_FROM_TEXT_POS (w->start, startp);
- if (current_buffer != XBUFFER (w->buffer))
+ if (current_buffer != XBUFFER (w->contents))
emacs_abort ();
if (!NILP (Vwindow_scroll_functions))
@@ -14354,7 +14385,7 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp)
make_number (CHARPOS (startp)));
SET_TEXT_POS_FROM_MARKER (startp, w->start);
/* In case the hook functions switch buffers. */
- set_buffer_internal (XBUFFER (w->buffer));
+ set_buffer_internal (XBUFFER (w->contents));
}
return startp;
@@ -15005,7 +15036,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
must_scroll = 1;
}
else if (rc != CURSOR_MOVEMENT_SUCCESS
- && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)))
+ && !NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering)))
{
struct glyph_row *row1;
@@ -15068,7 +15099,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
else if (scroll_p)
rc = CURSOR_MOVEMENT_MUST_SCROLL;
else if (rc != CURSOR_MOVEMENT_SUCCESS
- && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)))
+ && !NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering)))
{
/* With bidi-reordered rows, there could be more than
one candidate row whose start and end positions
@@ -15175,7 +15206,7 @@ set_vertical_scroll_bar (struct window *w)
|| (w == XWINDOW (minibuf_window)
&& NILP (echo_area_buffer[0])))
{
- struct buffer *buf = XBUFFER (w->buffer);
+ struct buffer *buf = XBUFFER (w->contents);
whole = BUF_ZV (buf) - BUF_BEGV (buf);
start = marker_position (w->start) - BUF_BEGV (buf);
/* I don't think this is guaranteed to be right. For the
@@ -15209,7 +15240,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
{
struct window *w = XWINDOW (window);
struct frame *f = XFRAME (w->frame);
- struct buffer *buffer = XBUFFER (w->buffer);
+ struct buffer *buffer = XBUFFER (w->contents);
struct buffer *old = current_buffer;
struct text_pos lpoint, opoint, startp;
int update_mode_line;
@@ -15231,12 +15262,14 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
SET_TEXT_POS (lpoint, PT, PT_BYTE);
opoint = lpoint;
- /* W must be a leaf window here. */
- eassert (!NILP (w->buffer));
#ifdef GLYPH_DEBUG
*w->desired_matrix->method = 0;
#endif
+ /* Make sure that both W's markers are valid. */
+ eassert (XMARKER (w->start)->buffer == buffer);
+ eassert (XMARKER (w->pointm)->buffer == buffer);
+
restart:
reconsider_clip_changes (w, buffer);
@@ -15262,10 +15295,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
else if ((w != XWINDOW (minibuf_window)
|| minibuf_level == 0)
/* When buffer is nonempty, redisplay window normally. */
- && BUF_Z (XBUFFER (w->buffer)) == BUF_BEG (XBUFFER (w->buffer))
+ && BUF_Z (XBUFFER (w->contents)) == BUF_BEG (XBUFFER (w->contents))
/* Quail displays non-mini buffers in minibuffer window.
In that case, redisplay the window normally. */
- && !NILP (Fmemq (w->buffer, Vminibuffer_list)))
+ && !NILP (Fmemq (w->contents, Vminibuffer_list)))
{
/* W is a mini-buffer window, but it's not active, so clear
it. */
@@ -15287,7 +15320,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
value. */
/* Really select the buffer, for the sake of buffer-local
variables. */
- set_buffer_internal_1 (XBUFFER (w->buffer));
+ set_buffer_internal_1 (XBUFFER (w->contents));
current_matrix_up_to_date_p
= (w->window_end_valid
@@ -15520,7 +15553,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
/* If we are highlighting the region, then we just changed
the region, so redisplay to show it. */
- if (0 <= markpos_of_region ())
+ if (markpos_of_region () >= 0)
{
clear_glyph_matrix (w->desired_matrix);
if (!try_window (window, startp, 0))
@@ -16221,7 +16254,7 @@ try_window_reusing_current_matrix (struct window *w)
return 0;
/* Can't do this if region may have changed. */
- if (0 <= markpos_of_region ()
+ if (markpos_of_region () >= 0
|| w->region_showing
|| !NILP (Vshow_trailing_whitespace))
return 0;
@@ -16578,7 +16611,7 @@ try_window_reusing_current_matrix (struct window *w)
bidi-reordered glyph rows. Let set_cursor_from_row
figure out where to put the cursor, and if it fails,
give up. */
- if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)))
+ if (!NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering)))
{
if (!set_cursor_from_row (w, row, w->current_matrix,
0, 0, 0, 0))
@@ -16829,7 +16862,7 @@ sync_frame_with_window_matrix_rows (struct window *w)
/* Preconditions: W must be a leaf window and full-width. Its frame
must have a frame matrix. */
- eassert (NILP (w->hchild) && NILP (w->vchild));
+ eassert (BUFFERP (w->contents));
eassert (WINDOW_FULL_WIDTH_P (w));
eassert (!FRAME_WINDOW_P (f));
@@ -16871,7 +16904,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos,
{
struct glyph_row *row = start;
struct glyph_row *best_row = NULL;
- ptrdiff_t mindif = BUF_ZV (XBUFFER (w->buffer)) + 1;
+ ptrdiff_t mindif = BUF_ZV (XBUFFER (w->contents)) + 1;
int last_y;
/* If we happen to start on a header-line, skip that. */
@@ -16899,21 +16932,20 @@ row_containing_pos (struct window *w, ptrdiff_t charpos,
|| (MATRIX_ROW_END_CHARPOS (row) == charpos
/* The end position of a row equals the start
position of the next row. If CHARPOS is there, we
- would rather display it in the next line, except
- when this line ends in ZV. */
- && !row->ends_at_zv_p
- && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)))
+ would rather consider it displayed in the next
+ line, except when this line ends in ZV. */
+ && !row_for_charpos_p (row, charpos)))
&& charpos >= MATRIX_ROW_START_CHARPOS (row))
{
struct glyph *g;
- if (NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))
+ if (NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering))
|| (!best_row && !row->continued_p))
return row;
- /* In bidi-reordered rows, there could be several rows
- occluding point, all of them belonging to the same
- continued line. We need to find the row which fits
- CHARPOS the best. */
+ /* In bidi-reordered rows, there could be several rows whose
+ edges surround CHARPOS, all of these rows belonging to
+ the same continued line. We need to find the row which
+ fits CHARPOS the best. */
for (g = row->glyphs[TEXT_AREA];
g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA];
g++)
@@ -17053,7 +17085,7 @@ try_window_id (struct window *w)
/* Can't use this if highlighting a region because a cursor movement
will do more than just set the cursor. */
- if (0 <= markpos_of_region ())
+ if (markpos_of_region () >= 0)
GIVE_UP (9);
/* Likewise if highlighting trailing whitespace. */
@@ -17073,7 +17105,7 @@ try_window_id (struct window *w)
wrapped line can change the wrap position, altering the line
above it. It might be worthwhile to handle this more
intelligently, but for now just redisplay from scratch. */
- if (!NILP (BVAR (XBUFFER (w->buffer), word_wrap)))
+ if (!NILP (BVAR (XBUFFER (w->contents), word_wrap)))
GIVE_UP (21);
/* Under bidi reordering, adding or deleting a character in the
@@ -17084,8 +17116,8 @@ try_window_id (struct window *w)
to find the paragraph limits and widen the range of redisplayed
lines to that, but for now just give up this optimization and
redisplay from scratch. */
- if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))
- && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction)))
+ if (!NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering))
+ && NILP (BVAR (XBUFFER (w->contents), bidi_paragraph_direction)))
GIVE_UP (22);
/* Make sure beg_unchanged and end_unchanged are up to date. Do it
@@ -17950,7 +17982,7 @@ glyphs in short form, otherwise show glyphs in long form. */)
(Lisp_Object glyphs)
{
struct window *w = XWINDOW (selected_window);
- struct buffer *buffer = XBUFFER (w->buffer);
+ struct buffer *buffer = XBUFFER (w->contents);
fprintf (stderr, "PT = %"pI"d, BEGV = %"pI"d. ZV = %"pI"d\n",
BUF_PT (buffer), BUF_BEGV (buffer), BUF_ZV (buffer));
@@ -18056,7 +18088,7 @@ static struct glyph_row *
get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string)
{
struct frame *f = XFRAME (WINDOW_FRAME (w));
- struct buffer *buffer = XBUFFER (w->buffer);
+ struct buffer *buffer = XBUFFER (w->contents);
struct buffer *old = current_buffer;
const unsigned char *arrow_string = SDATA (overlay_arrow_string);
int arrow_len = SCHARS (overlay_arrow_string);
@@ -18717,15 +18749,15 @@ highlight_trailing_whitespace (struct frame *f, struct glyph_row *row)
/* Value is non-zero if glyph row ROW should be
- used to hold the cursor. */
+ considered to hold the buffer position CHARPOS. */
static int
-cursor_row_p (struct glyph_row *row)
+row_for_charpos_p (struct glyph_row *row, ptrdiff_t charpos)
{
int result = 1;
- if (PT == CHARPOS (row->end.pos)
- || PT == MATRIX_ROW_END_CHARPOS (row))
+ if (charpos == CHARPOS (row->end.pos)
+ || charpos == MATRIX_ROW_END_CHARPOS (row))
{
/* Suppose the row ends on a string.
Unless the row is continued, that means it ends on a newline
@@ -18751,7 +18783,7 @@ cursor_row_p (struct glyph_row *row)
if (STRINGP (glyph->object))
{
Lisp_Object prop
- = Fget_char_property (make_number (PT),
+ = Fget_char_property (make_number (charpos),
Qdisplay, Qnil);
result =
(!NILP (prop)
@@ -18805,6 +18837,15 @@ cursor_row_p (struct glyph_row *row)
return result;
}
+/* Value is non-zero if glyph row ROW should be
+ used to hold the cursor. */
+
+static int
+cursor_row_p (struct glyph_row *row)
+{
+ return row_for_charpos_p (row, PT);
+}
+
/* Push the property PROP so that it will be rendered at the current
@@ -19263,7 +19304,7 @@ display_line (struct it *it)
row->glyphs[TEXT_AREA]->charpos = -1;
row->displays_text_p = 0;
- if (!NILP (BVAR (XBUFFER (it->w->buffer), indicate_empty_lines))
+ if (!NILP (BVAR (XBUFFER (it->w->contents), indicate_empty_lines))
&& (!MINI_WINDOW_P (it->w)
|| (minibuf_level && EQ (it->window, minibuf_window))))
row->indicate_empty_line_p = 1;
@@ -19988,18 +20029,17 @@ display_menu_bar (struct window *w)
return;
#endif /* HAVE_NS */
-#ifdef USE_X_TOOLKIT
+#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
eassert (!FRAME_WINDOW_P (f));
init_iterator (&it, w, -1, -1, f->desired_matrix->rows, MENU_FACE_ID);
it.first_visible_x = 0;
it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
-#else /* not USE_X_TOOLKIT */
+#elif defined (HAVE_X_WINDOWS) /* X without toolkit. */
if (FRAME_WINDOW_P (f))
{
/* Menu bar lines are displayed in the desired matrix of the
dummy window menu_bar_window. */
struct window *menu_w;
- eassert (WINDOWP (f->menu_bar_window));
menu_w = XWINDOW (f->menu_bar_window);
init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows,
MENU_FACE_ID);
@@ -20007,6 +20047,7 @@ display_menu_bar (struct window *w)
it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
}
else
+#endif /* not USE_X_TOOLKIT and not USE_GTK */
{
/* This is a TTY frame, i.e. character hpos/vpos are used as
pixel x/y. */
@@ -20015,7 +20056,6 @@ display_menu_bar (struct window *w)
it.first_visible_x = 0;
it.last_visible_x = FRAME_COLS (f);
}
-#endif /* not USE_X_TOOLKIT */
/* FIXME: This should be controlled by a user option. See the
comments in redisplay_tool_bar and display_mode_line about
@@ -20079,10 +20119,8 @@ redisplay_mode_lines (Lisp_Object window, int force)
{
struct window *w = XWINDOW (window);
- if (WINDOWP (w->hchild))
- nwindows += redisplay_mode_lines (w->hchild, force);
- else if (WINDOWP (w->vchild))
- nwindows += redisplay_mode_lines (w->vchild, force);
+ if (WINDOWP (w->contents))
+ nwindows += redisplay_mode_lines (w->contents, force);
else if (force
|| FRAME_GARBAGED_P (XFRAME (w->frame))
|| !MATRIX_MODE_LINE_ROW (w->current_matrix)->enabled_p)
@@ -20092,7 +20130,7 @@ redisplay_mode_lines (Lisp_Object window, int force)
/* Set the window's buffer for the mode line display. */
SET_TEXT_POS (lpoint, PT, PT_BYTE);
- set_buffer_internal_1 (XBUFFER (w->buffer));
+ set_buffer_internal_1 (XBUFFER (w->contents));
/* Point refers normally to the selected window. For any
other window, set up appropriate value. */
@@ -20874,7 +20912,7 @@ are the selected window and the WINDOW's buffer). */)
XSETWINDOW (window, w);
if (NILP (buffer))
- buffer = w->buffer;
+ buffer = w->contents;
CHECK_BUFFER (buffer);
/* Make formatting the modeline a non-op when noninteractive, otherwise
@@ -21009,7 +21047,7 @@ pint2hrstr (char *buf, int width, ptrdiff_t d)
char * psuffix;
char * p;
- if (1000 <= quotient)
+ if (quotient >= 1000)
{
/* Scale to the appropriate EXPONENT. */
do
@@ -21018,13 +21056,13 @@ pint2hrstr (char *buf, int width, ptrdiff_t d)
quotient /= 1000;
exponent++;
}
- while (1000 <= quotient);
+ while (quotient >= 1000);
/* Round to nearest and decide whether to use TENTHS or not. */
if (quotient <= 9)
{
tenths = remainder / 100;
- if (50 <= remainder % 100)
+ if (remainder % 100 >= 50)
{
if (tenths < 9)
tenths++;
@@ -21039,7 +21077,7 @@ pint2hrstr (char *buf, int width, ptrdiff_t d)
}
}
else
- if (500 <= remainder)
+ if (remainder >= 500)
{
if (quotient < 999)
quotient++;
@@ -22082,11 +22120,6 @@ else if the text is replaced by an ellipsis. */)
*/
-#define NUMVAL(X) \
- ((INTEGERP (X) || FLOATP (X)) \
- ? XFLOATINT (X) \
- : - 1)
-
static int
calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
struct font *font, int width_p, int *align_to)
@@ -22117,24 +22150,11 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
pixels = 0;
if (pixels > 0)
{
- double ppi;
-#ifdef HAVE_WINDOW_SYSTEM
- if (FRAME_WINDOW_P (it->f)
- && (ppi = (width_p
- ? FRAME_X_DISPLAY_INFO (it->f)->resx
- : FRAME_X_DISPLAY_INFO (it->f)->resy),
- ppi > 0))
- return OK_PIXELS (ppi / pixels);
-#endif
+ double ppi = (width_p ? FRAME_RES_X (it->f)
+ : FRAME_RES_Y (it->f));
- if ((ppi = NUMVAL (Vdisplay_pixels_per_inch), ppi > 0)
- || (CONSP (Vdisplay_pixels_per_inch)
- && (ppi = (width_p
- ? NUMVAL (XCAR (Vdisplay_pixels_per_inch))
- : NUMVAL (XCDR (Vdisplay_pixels_per_inch))),
- ppi > 0)))
+ if (ppi > 0)
return OK_PIXELS (ppi / pixels);
-
return 0;
}
}
@@ -22198,7 +22218,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w));
}
- prop = buffer_local_value_1 (prop, it->w->buffer);
+ prop = buffer_local_value_1 (prop, it->w->contents);
if (EQ (prop, Qunbound))
prop = Qnil;
}
@@ -22250,7 +22270,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
return OK_PIXELS (pixels);
}
- car = buffer_local_value_1 (car, it->w->buffer);
+ car = buffer_local_value_1 (car, it->w->contents);
if (EQ (car, Qunbound))
car = Qnil;
}
@@ -22410,16 +22430,16 @@ get_char_face_and_encoding (struct frame *f, int c, int face_id,
XChar2b *char2b, int display_p)
{
struct face *face = FACE_FROM_ID (f, face_id);
+ unsigned code = 0;
if (face->font)
{
- unsigned code = face->font->driver->encode_char (face->font, c);
+ code = face->font->driver->encode_char (face->font, c);
- if (code != FONT_INVALID_CODE)
- STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF));
- else
- STORE_XCHAR2B (char2b, 0, 0);
+ if (code == FONT_INVALID_CODE)
+ code = 0;
}
+ STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF));
/* Make sure X resources of the face are allocated. */
#ifdef HAVE_X_WINDOWS
@@ -22443,31 +22463,30 @@ get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph,
XChar2b *char2b, int *two_byte_p)
{
struct face *face;
+ unsigned code = 0;
eassert (glyph->type == CHAR_GLYPH);
face = FACE_FROM_ID (f, glyph->face_id);
+ /* Make sure X resources of the face are allocated. */
+ eassert (face != NULL);
+ PREPARE_FACE_FOR_DISPLAY (f, face);
+
if (two_byte_p)
*two_byte_p = 0;
if (face->font)
{
- unsigned code;
-
if (CHAR_BYTE8_P (glyph->u.ch))
code = CHAR_TO_BYTE8 (glyph->u.ch);
else
code = face->font->driver->encode_char (face->font, glyph->u.ch);
- if (code != FONT_INVALID_CODE)
- STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF));
- else
- STORE_XCHAR2B (char2b, 0, 0);
+ if (code == FONT_INVALID_CODE)
+ code = 0;
}
- /* Make sure X resources of the face are allocated. */
- eassert (face != NULL);
- PREPARE_FACE_FOR_DISPLAY (f, face);
+ STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF));
return face;
}
@@ -22777,9 +22796,12 @@ static struct font_metrics *
get_per_char_metric (struct font *font, XChar2b *char2b)
{
static struct font_metrics metrics;
- unsigned code = (XCHAR2B_BYTE1 (char2b) << 8) | XCHAR2B_BYTE2 (char2b);
+ unsigned code;
- if (! font || code == FONT_INVALID_CODE)
+ if (! font)
+ return NULL;
+ code = (XCHAR2B_BYTE1 (char2b) << 8) | XCHAR2B_BYTE2 (char2b);
+ if (code == FONT_INVALID_CODE)
return NULL;
font->driver->text_extents (font, &code, 1, &metrics);
return &metrics;
@@ -24100,7 +24122,7 @@ produce_stretch_glyph (struct it *it)
int n = width;
if (!STRINGP (object))
- object = it->w->buffer;
+ object = it->w->contents;
#ifdef HAVE_WINDOW_SYSTEM
if (FRAME_WINDOW_P (it->f))
append_stretch_glyph (it, object, width, height, ascent);
@@ -25496,7 +25518,7 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
int *active_cursor)
{
struct frame *f = XFRAME (w->frame);
- struct buffer *b = XBUFFER (w->buffer);
+ struct buffer *b = XBUFFER (w->contents);
int cursor_type = DEFAULT_CURSOR;
Lisp_Object alt_cursor;
int non_selected = 0;
@@ -26047,10 +26069,8 @@ update_cursor_in_window_tree (struct window *w, int on_p)
{
while (w)
{
- if (!NILP (w->hchild))
- update_cursor_in_window_tree (XWINDOW (w->hchild), on_p);
- else if (!NILP (w->vchild))
- update_cursor_in_window_tree (XWINDOW (w->vchild), on_p);
+ if (WINDOWP (w->contents))
+ update_cursor_in_window_tree (XWINDOW (w->contents), on_p);
else
update_window_cursor (w, on_p);
@@ -27296,7 +27316,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
{
help_echo_string = help;
XSETWINDOW (help_echo_window, w);
- help_echo_object = w->buffer;
+ help_echo_object = w->contents;
help_echo_pos = charpos;
}
}
@@ -27332,7 +27352,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
{
Lisp_Object default_help
= buffer_local_value_1 (Qmode_line_default_help_echo,
- w->buffer);
+ w->contents);
if (STRINGP (default_help))
{
@@ -27607,7 +27627,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
/* Are we in a window whose display is up to date?
And verify the buffer's text has not changed. */
- b = XBUFFER (w->buffer);
+ b = XBUFFER (w->contents);
if (part == ON_TEXT
&& w->window_end_valid
&& w->last_modified == BUF_MODIFF (b)
@@ -27816,8 +27836,8 @@ note_mouse_highlight (struct frame *f, int x, int y)
if (pos > 0)
{
mouse_face = get_char_property_and_overlay
- (make_number (pos), Qmouse_face, w->buffer, &overlay);
- buffer = w->buffer;
+ (make_number (pos), Qmouse_face, w->contents, &overlay);
+ buffer = w->contents;
disp_string = object;
}
}
@@ -27930,11 +27950,11 @@ note_mouse_highlight (struct frame *f, int x, int y)
if (p > 0)
{
help = Fget_char_property (make_number (p),
- Qhelp_echo, w->buffer);
+ Qhelp_echo, w->contents);
if (!NILP (help))
{
charpos = p;
- obj = w->buffer;
+ obj = w->contents;
}
}
}
@@ -27985,7 +28005,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
ptrdiff_t p = string_buffer_position (obj, start);
if (p > 0)
pointer = Fget_char_property (make_number (p),
- Qpointer, w->buffer);
+ Qpointer, w->contents);
}
}
else if (BUFFERP (obj)
@@ -28428,12 +28448,9 @@ expose_window_tree (struct window *w, XRectangle *r)
while (w && !FRAME_GARBAGED_P (f))
{
- if (!NILP (w->hchild))
+ if (WINDOWP (w->contents))
mouse_face_overwritten_p
- |= expose_window_tree (XWINDOW (w->hchild), r);
- else if (!NILP (w->vchild))
- mouse_face_overwritten_p
- |= expose_window_tree (XWINDOW (w->vchild), r);
+ |= expose_window_tree (XWINDOW (w->contents), r);
else
mouse_face_overwritten_p |= expose_window (w, r);
@@ -28498,11 +28515,11 @@ expose_frame (struct frame *f, int x, int y, int w, int h)
#ifdef HAVE_X_WINDOWS
#ifndef MSDOS
-#ifndef USE_X_TOOLKIT
+#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
if (WINDOWP (f->menu_bar_window))
mouse_face_overwritten_p
|= expose_window (XWINDOW (f->menu_bar_window), &r);
-#endif /* not USE_X_TOOLKIT */
+#endif /* not USE_X_TOOLKIT and not USE_GTK */
#endif
#endif
@@ -29236,13 +29253,13 @@ init_xdisp (void)
echo_area_window = minibuf_window;
- wset_top_line (r, make_number (FRAME_TOP_MARGIN (f)));
- wset_total_lines
- (r, make_number (FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f)));
- wset_total_cols (r, make_number (FRAME_COLS (f)));
- wset_top_line (m, make_number (FRAME_LINES (f) - 1));
- wset_total_lines (m, make_number (1));
- wset_total_cols (m, make_number (FRAME_COLS (f)));
+ r->top_line = FRAME_TOP_MARGIN (f);
+ r->total_lines = FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f);
+ r->total_cols = FRAME_COLS (f);
+
+ m->top_line = FRAME_LINES (f) - 1;
+ m->total_lines = 1;
+ m->total_cols = FRAME_COLS (f);
scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs;
scratch_glyph_row.glyphs[TEXT_AREA + 1]