X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/b7ad5db04ba068ac9cbcfb9a02291e957d093a32..c558890bde00f4b5079edd2c1d0d51086af3b13b:/src/xdisp.c diff --git a/src/xdisp.c b/src/xdisp.c index 5b96144438..290f69878d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -7,8 +7,8 @@ This file is part of GNU Emacs. 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 @@ -2946,7 +2946,7 @@ init_iterator (struct it *it, struct window *w, 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; @@ -6641,7 +6641,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string, 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) @@ -7229,18 +7229,21 @@ get_next_display_element (struct it *it) { 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; @@ -7249,19 +7252,49 @@ get_next_display_element (struct it *it) 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); @@ -10531,8 +10564,8 @@ ensure_echo_area_buffers (void) 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. */ @@ -10566,7 +10599,7 @@ with_echo_area_buffer (struct window *w, int which, 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])) { @@ -13475,7 +13508,7 @@ redisplay_internal (void) 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; @@ -21194,7 +21227,7 @@ See also `bidi-paragraph-direction'. */) || 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); @@ -21318,7 +21351,7 @@ the `bidi-class' property of a character. */) /* 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); @@ -21346,7 +21379,7 @@ the `bidi-class' property of a character. */) /* 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); @@ -31084,7 +31117,7 @@ syms_of_xdisp (void) /* 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. @@ -31353,8 +31386,11 @@ Value is a number or a cons (WIDTH-DPI . HEIGHT-DPI). */); 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. @@ -31389,7 +31425,7 @@ This variable is not guaranteed to be accurate except while processing 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 @@ -31397,10 +31433,10 @@ which no explicit name has been set (see `modify-frame-parameters'). */); 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, @@ -31552,7 +31588,12 @@ A value of t means resize them to fit the text displayed in them. 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. @@ -31760,6 +31801,12 @@ display table takes effect; in this case, Emacs does not consult 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; }