aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c49
1 files changed, 46 insertions, 3 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index b5adee51055..6606e49e428 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -25451,14 +25451,49 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
25451 format_mode_line_unwind_data (NULL, NULL, 25451 format_mode_line_unwind_data (NULL, NULL,
25452 Qnil, false)); 25452 Qnil, false));
25453 25453
25454 mode_line_target = MODE_LINE_DISPLAY;
25455
25456 /* Temporarily make frame's keyboard the current kboard so that 25454 /* Temporarily make frame's keyboard the current kboard so that
25457 kboard-local variables in the mode_line_format will get the right 25455 kboard-local variables in the mode_line_format will get the right
25458 values. */ 25456 values. */
25459 push_kboard (FRAME_KBOARD (it.f)); 25457 push_kboard (FRAME_KBOARD (it.f));
25460 record_unwind_save_match_data (); 25458 record_unwind_save_match_data ();
25461 display_mode_element (&it, 0, 0, 0, format, Qnil, false); 25459
25460 if (NILP (Vmode_line_compact))
25461 {
25462 mode_line_target = MODE_LINE_DISPLAY;
25463 display_mode_element (&it, 0, 0, 0, format, Qnil, false);
25464 }
25465 else
25466 {
25467 Lisp_Object mode_string = Fformat_mode_line (format, Qnil, Qnil, Qnil);
25468 if (EQ (Vmode_line_compact, Qlong)
25469 && window_body_width (XWINDOW (selected_window), FALSE) >=
25470 SCHARS (mode_string))
25471 {
25472 display_string (SSDATA (mode_string), Qnil, Qnil, 0, 0, &it, 0, 0, 0,
25473 STRING_MULTIBYTE (mode_string));
25474 }
25475 else
25476 {
25477 char *string = xmalloc (SBYTES (mode_string) + 1),
25478 *ostring = SSDATA (mode_string);
25479 char *s = string, prev = 0;
25480
25481 /* Copy over the data from the mode line string, but ignore
25482 repeating spaces. This should be safe even for multibyte
25483 strings, since this is UTF-8. */
25484 for (int i = 0; i < SBYTES (mode_string); i++)
25485 {
25486 char c = ostring[i];
25487 if (!(c == ' ' && prev == ' '))
25488 prev = *s++ = c;
25489 }
25490 *s = 0;
25491
25492 display_string (string, Qnil, Qnil, 0, 0, &it, 0, 0, 0,
25493 STRING_MULTIBYTE (mode_string));
25494 xfree (string);
25495 }
25496 }
25462 pop_kboard (); 25497 pop_kboard ();
25463 25498
25464 unbind_to (count, Qnil); 25499 unbind_to (count, Qnil);
@@ -34805,6 +34840,14 @@ wide as that tab on the display. */);
34805The face used for trailing whitespace is `trailing-whitespace'. */); 34840The face used for trailing whitespace is `trailing-whitespace'. */);
34806 Vshow_trailing_whitespace = Qnil; 34841 Vshow_trailing_whitespace = Qnil;
34807 34842
34843 DEFVAR_LISP ("mode-line-compact", Vmode_line_compact,
34844 doc: /* Non-nil means that mode lines should be compact.
34845This means that repeating spaces will be replaced with a single space.
34846If this variable is `long', only mode lines that are wider than the
34847currently selected window are compressed. */);
34848 Vmode_line_compact = Qnil;
34849 DEFSYM (Qlong, "long");
34850
34808 DEFVAR_LISP ("nobreak-char-display", Vnobreak_char_display, 34851 DEFVAR_LISP ("nobreak-char-display", Vnobreak_char_display,
34809 doc: /* Control highlighting of non-ASCII space and hyphen chars. 34852 doc: /* Control highlighting of non-ASCII space and hyphen chars.
34810If the value is t, Emacs highlights non-ASCII chars which have the 34853If the value is t, Emacs highlights non-ASCII chars which have the