GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
character properties needed for reordering are not yet
available. */
it->bidi_p =
- NILP (Vpurify_flag)
+ !redisplay__inhibit_bidi
&& !NILP (BVAR (current_buffer, bidi_display_reordering))
&& it->multibyte_p;
loading loadup.el, as the necessary character property tables are
not yet available. */
it->bidi_p =
- NILP (Vpurify_flag)
+ !redisplay__inhibit_bidi
&& !NILP (BVAR (&buffer_defaults, bidi_display_reordering));
if (s == NULL)
{
ptrdiff_t ignore;
int next_face_id;
+ bool text_from_string = false;
+ /* Normally, the next buffer location is stored in
+ IT->current.pos... */
struct text_pos pos = it->current.pos;
- /* For a string from a display property, the next
- buffer position is stored in the 'position'
+ /* ...but for a string from a display property, the
+ next buffer position is stored in the 'position'
member of the iteration stack slot below the
current one, see handle_single_display_spec. By
- contrast, it->current.pos was not yet updated
- to point to that buffer position; that will
- happen in pop_it, after we finish displaying the
- current string. Note that we already checked
- above that it->sp is positive, so subtracting one
- from it is safe. */
+ contrast, it->current.pos was not yet updated to
+ point to that buffer position; that will happen
+ in pop_it, after we finish displaying the current
+ string. Note that we already checked above that
+ it->sp is positive, so subtracting one from it is
+ safe. */
if (it->from_disp_prop_p)
{
int stackp = it->sp - 1;
while (stackp >= 0
&& STRINGP ((it->stack + stackp)->string))
stackp--;
- eassert (stackp >= 0);
- pos = (it->stack + stackp)->position;
+ if (stackp < 0)
+ {
+ /* If no stack slot was found for iterating
+ a buffer, we are displaying text from a
+ string, most probably the mode line or
+ the header line, and that string has a
+ display string on some of its
+ characters. */
+ text_from_string = true;
+ pos = it->stack[it->sp - 1].position;
+ }
+ else
+ pos = (it->stack + stackp)->position;
}
else
INC_TEXT_POS (pos, it->multibyte_p);
- if (CHARPOS (pos) >= ZV)
+ if (text_from_string)
+ {
+ Lisp_Object base_string = it->stack[it->sp - 1].string;
+
+ if (CHARPOS (pos) >= SCHARS (base_string) - 1)
+ it->end_of_box_run_p = true;
+ else
+ {
+ next_face_id
+ = face_at_string_position (it->w, base_string,
+ CHARPOS (pos), 0,
+ &ignore, face_id, false);
+ it->end_of_box_run_p
+ = (FACE_FROM_ID (it->f, next_face_id)->box
+ == FACE_NO_BOX);
+ }
+ }
+ else if (CHARPOS (pos) >= ZV)
it->end_of_box_run_p = true;
else
{
- next_face_id = face_at_buffer_position
- (it->w, CHARPOS (pos), &ignore,
- CHARPOS (pos) + TEXT_PROP_DISTANCE_LIMIT, false, -1);
+ next_face_id =
+ face_at_buffer_position (it->w, CHARPOS (pos), &ignore,
+ 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);
The optional argument FROM, if non-nil, specifies the first text
position and defaults to the minimum accessible position of the buffer.
-If FROM is t, use the minimum accessible position that is not a newline
-character. TO, if non-nil, specifies the last text position and
+If FROM is t, use the minimum accessible position that starts a
+non-empty line. TO, if non-nil, specifies the last text position and
defaults to the maximum accessible position of the buffer. If TO is t,
-use the maximum accessible position that is not a newline character.
+use the maximum accessible position that ends a non-empty line.
The optional argument X-LIMIT, if non-nil, specifies the maximum text
width that can be returned. X-LIMIT nil or omitted, means to use the
-pixel-width of WINDOW's body; use this if you do not intend to change
-the width of WINDOW. Use the maximum width WINDOW may assume if you
-intend to change WINDOW's width. In any case, text whose x-coordinate
-is beyond X-LIMIT is ignored. Since calculating the width of long lines
-can take some time, it's always a good idea to make this argument as
-small as possible; in particular, if the buffer contains long lines that
-shall be truncated anyway.
+pixel-width of WINDOW's body; use this if you want to know how high
+WINDOW should be become in order to fit all of its buffer's text with
+the width of WINDOW unaltered. Use the maximum width WINDOW may assume
+if you intend to change WINDOW's width. In any case, text whose
+x-coordinate is beyond X-LIMIT is ignored. Since calculating the width
+of long lines can take some time, it's always a good idea to make this
+argument as small as possible; in particular, if the buffer contains
+long lines that shall be truncated anyway.
The optional argument Y-LIMIT, if non-nil, specifies the maximum text
-height that can be returned. Text lines whose y-coordinate is beyond
-Y-LIMIT are ignored. Since calculating the text height of a large
-buffer can take some time, it makes sense to specify this argument if
-the size of the buffer is unknown.
+height (exluding the height of the mode- or header-line, if any) that
+can be returned. Text lines whose y-coordinate is beyond Y-LIMIT are
+ignored. Since calculating the text height of a large buffer can take
+some time, it makes sense to specify this argument if the size of the
+buffer is large or unknown.
Optional argument MODE-AND-HEADER-LINE nil or omitted means do not
include the height of the mode- or header-line of WINDOW in the return
ptrdiff_t start, end, pos;
struct text_pos startp;
void *itdata = NULL;
- int c, max_y = -1, x = 0, y = 0;
+ int c, max_x = 0, max_y = 0, x = 0, y = 0;
CHECK_BUFFER (buffer);
b = XBUFFER (buffer);
end = max (start, min (XINT (to), ZV));
}
- if (!NILP (y_limit))
- {
- CHECK_NUMBER (y_limit);
- max_y = min (XINT (y_limit), INT_MAX);
- }
+ if (!NILP (x_limit) && RANGED_INTEGERP (0, x_limit, INT_MAX))
+ max_x = XINT (x_limit);
+
+ if (NILP (y_limit))
+ max_y = INT_MAX;
+ else if (RANGED_INTEGERP (0, y_limit, INT_MAX))
+ max_y = XINT (y_limit);
itdata = bidi_shelve_cache ();
SET_TEXT_POS (startp, start, CHAR_TO_BYTE (start));
x = move_it_to (&it, end, -1, max_y, -1, MOVE_TO_POS | MOVE_TO_Y);
else
{
- CHECK_NUMBER (x_limit);
- it.last_visible_x = min (XINT (x_limit), INFINITY);
+ it.last_visible_x = max_x;
/* Actually, we never want move_it_to stop at to_x. But to make
sure that move_it_in_display_line_to always moves far enough,
- we set it to INT_MAX and specify MOVE_TO_X. */
- x = move_it_to (&it, end, INT_MAX, max_y, -1,
- MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y);
+ we set it to INT_MAX and specify MOVE_TO_X. Also bound width
+ value by X-LIMIT. */
+ x = min (move_it_to (&it, end, INT_MAX, max_y, -1,
+ MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y),
+ max_x);
}
- y = it.current_y + it.max_ascent + it.max_descent;
+ /* Subtract height of header-line which was counted automatically by
+ start_display. */
+ y = min (it.current_y + it.max_ascent + it.max_descent
+ - WINDOW_HEADER_LINE_HEIGHT (w),
+ max_y);
- if (!EQ (mode_and_header_line, Qheader_line)
- && !EQ (mode_and_header_line, Qt))
- /* Do not count the header-line which was counted automatically by
- start_display. */
- y = y - WINDOW_HEADER_LINE_HEIGHT (w);
+ if (EQ (mode_and_header_line, Qheader_line)
+ || EQ (mode_and_header_line, Qt))
+ /* Re-add height of header-line as requested. */
+ y = y + WINDOW_HEADER_LINE_HEIGHT (w);
if (EQ (mode_and_header_line, Qmode_line)
|| EQ (mode_and_header_line, Qt))
- /* Do count the mode-line which is not included automatically by
- start_display. */
+ /* Add height of mode-line as requested. */
y = y + WINDOW_MODE_LINE_HEIGHT (w);
bidi_unshelve_cache (itdata, false);
suitable buffer from echo_buffer[] and clear it.
If WHICH < 0, set echo_area_buffer[1] to echo_area_buffer[0], so
- that the current message becomes the last displayed one, make
- choose a suitable buffer for echo_area_buffer[0], and clear it.
+ that the current message becomes the last displayed one, choose a
+ suitable buffer for echo_area_buffer[0], and clear it.
Value is what FN returns. */
echo_area_buffer[this_one] = Qnil;
}
- /* Choose a suitable buffer from echo_buffer[] is we don't
+ /* Choose a suitable buffer from echo_buffer[] if we don't
have one. */
if (NILP (echo_area_buffer[this_one]))
{
specbind (Qinhibit_free_realized_faces, Qnil);
/* Record this function, so it appears on the profiler's backtraces. */
- record_in_backtrace (Qredisplay_internal, 0, 0);
+ record_in_backtrace (Qredisplay_internal_xC_functionx, 0, 0);
FOR_EACH_FRAME (tail, frame)
XFRAME (frame)->already_hscrolled_p = false;
|| NILP (BVAR (buf, enable_multibyte_characters))
/* When we are loading loadup.el, the character property tables
needed for bidi iteration are not yet available. */
- || !NILP (Vpurify_flag))
+ || redisplay__inhibit_bidi)
return Qleft_to_right;
else if (!NILP (BVAR (buf, bidi_paragraph_direction)))
return BVAR (buf, bidi_paragraph_direction);
/* When we are loading loadup.el, the character property
tables needed for bidi iteration are not yet
available. */
- || !NILP (Vpurify_flag))
+ || redisplay__inhibit_bidi)
return Qnil;
validate_subarray (object, from, to, SCHARS (object), &from_pos, &to_pos);
/* When we are loading loadup.el, the character property
tables needed for bidi iteration are not yet
available. */
- || !NILP (Vpurify_flag))
+ || redisplay__inhibit_bidi)
return Qnil;
set_buffer_temp (buf);
/* Non-nil means don't actually do any redisplay. */
DEFSYM (Qinhibit_redisplay, "inhibit-redisplay");
- DEFSYM (Qredisplay_internal, "redisplay_internal (C function)");
+ DEFSYM (Qredisplay_internal_xC_functionx, "redisplay_internal (C function)");
DEFVAR_BOOL("inhibit-message", inhibit_message,
doc: /* Non-nil means calls to `message' are not displayed.
Vtruncate_partial_width_windows,
doc: /* Non-nil means truncate lines in windows narrower than the frame.
For an integer value, truncate lines in each window narrower than the
-full frame width, provided the window width is less than that integer;
-otherwise, respect the value of `truncate-lines'.
+full frame width, provided the total window width in column units is less
+than that integer; otherwise, respect the value of `truncate-lines'.
+The total width of the window is as returned by `window-total-width', it
+includes the fringes, the continuation and truncation glyphs, the
+display margins (if any), and the scroll bar
For any other non-nil value, truncate lines in all windows that do
not span the full frame width.
DEFVAR_LISP ("frame-title-format", Vframe_title_format,
doc: /* Template for displaying the title bar of visible frames.
-(Assuming the window manager supports this feature.)
+\(Assuming the window manager supports this feature.)
This variable has the same structure as `mode-line-format', except that
the %c and %l constructs are ignored. It is used only on frames for
DEFVAR_LISP ("icon-title-format", Vicon_title_format,
doc: /* Template for displaying the title bar of an iconified frame.
-(Assuming the window manager supports this feature.)
+\(Assuming the window manager supports this feature.)
This variable has the same structure as `mode-line-format' (which see),
and is used only on frames for which no explicit name has been set
-(see `modify-frame-parameters'). */);
+\(see `modify-frame-parameters'). */);
Vicon_title_format
= Vframe_title_format
= listn (CONSTYPE_PURE, 3,
A value of `grow-only', the default, means let mini-windows grow only;
they return to their normal size when the minibuffer is closed, or the
echo area becomes empty. */);
- Vresize_mini_windows = Qgrow_only;
+ /* Contrary to the doc string, we initialize this to nil, so that
+ loading loadup.el won't try to resize windows before loading
+ window.el, where some functions we need to call for this live.
+ We assign the 'grow-only' value right after loading window.el
+ during loadup. */
+ Vresize_mini_windows = Qnil;
DEFVAR_LISP ("blink-cursor-alist", Vblink_cursor_alist,
doc: /* Alist specifying how to blink the cursor off.
DEFVAR_LISP ("redisplay--variables", Vredisplay__variables,
doc: /* A hash-table of variables changing which triggers a thorough redisplay. */);
Vredisplay__variables = Qnil;
+
+ DEFVAR_BOOL ("redisplay--inhibit-bidi", redisplay__inhibit_bidi,
+ doc: /* Non-nil means it is not safe to attempt bidi reordering for display. */);
+ /* Initialize to t, since we need to disable reordering until
+ loadup.el successfully loads charprop.el. */
+ redisplay__inhibit_bidi = true;
}