aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-07-03 08:05:55 +0800
committerPo Lu2023-07-03 08:05:55 +0800
commit61a38b470de2f9796ccf8273eca09622abc43368 (patch)
treef81cc79eb60687bfb65a1e0c800f09bac2357728 /src
parent2baf2c5fd9abe465a53e035131667e06ef553123 (diff)
parenta5bf0ae66141e7560f70a045c0dea132a4868c87 (diff)
downloademacs-61a38b470de2f9796ccf8273eca09622abc43368.tar.gz
emacs-61a38b470de2f9796ccf8273eca09622abc43368.zip
Merge remote-tracking branch 'origin/master' into feature/android
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c56
1 files changed, 54 insertions, 2 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index d928e9562d2..43c628b73d8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1194,6 +1194,7 @@ static void get_cursor_offset_for_mouse_face (struct window *w,
1194#endif /* HAVE_WINDOW_SYSTEM */ 1194#endif /* HAVE_WINDOW_SYSTEM */
1195 1195
1196static void produce_special_glyphs (struct it *, enum display_element_type); 1196static void produce_special_glyphs (struct it *, enum display_element_type);
1197static void pad_mode_line (struct it *, bool);
1197static void show_mouse_face (Mouse_HLInfo *, enum draw_glyphs_face); 1198static void show_mouse_face (Mouse_HLInfo *, enum draw_glyphs_face);
1198static bool coords_in_mouse_face_p (struct window *, int, int); 1199static bool coords_in_mouse_face_p (struct window *, int, int);
1199static void reset_box_start_end_flags (struct it *); 1200static void reset_box_start_end_flags (struct it *);
@@ -28877,7 +28878,11 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st
28877 { 28878 {
28878 /* Add truncation mark, but don't do it if the line is 28879 /* Add truncation mark, but don't do it if the line is
28879 truncated at a padding space. */ 28880 truncated at a padding space. */
28880 if (it_charpos < it->string_nchars) 28881 /* Need to do the below for the last string character as
28882 well, since it could be a double-width character, in
28883 which case the previous character ends before
28884 last_visible_x. Thus, comparison with <=, not <. */
28885 if (it_charpos <= it->string_nchars)
28881 { 28886 {
28882 if (!FRAME_WINDOW_P (it->f)) 28887 if (!FRAME_WINDOW_P (it->f))
28883 { 28888 {
@@ -28885,6 +28890,18 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st
28885 28890
28886 if (it->current_x > it->last_visible_x) 28891 if (it->current_x > it->last_visible_x)
28887 { 28892 {
28893 /* This flag is true if we are displaying mode
28894 line, false for header-line or tab-line. */
28895 bool mode_line_p = false;
28896
28897 /* ROW->mode_line_p is true if we display mode
28898 line or header-line or tab-line. */
28899 if (row->mode_line_p)
28900 {
28901 struct window *w = it->w;
28902 if (row == MATRIX_MODE_LINE_ROW (w->desired_matrix))
28903 mode_line_p = true;
28904 }
28888 if (!row->reversed_p) 28905 if (!row->reversed_p)
28889 { 28906 {
28890 for (ii = row->used[TEXT_AREA] - 1; ii > 0; --ii) 28907 for (ii = row->used[TEXT_AREA] - 1; ii > 0; --ii)
@@ -28902,7 +28919,10 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st
28902 for (n = row->used[TEXT_AREA]; ii < n; ++ii) 28919 for (n = row->used[TEXT_AREA]; ii < n; ++ii)
28903 { 28920 {
28904 row->used[TEXT_AREA] = ii; 28921 row->used[TEXT_AREA] = ii;
28905 produce_special_glyphs (it, IT_TRUNCATION); 28922 if (row->mode_line_p)
28923 pad_mode_line (it, mode_line_p);
28924 else
28925 produce_special_glyphs (it, IT_TRUNCATION);
28906 } 28926 }
28907 } 28927 }
28908 produce_special_glyphs (it, IT_TRUNCATION); 28928 produce_special_glyphs (it, IT_TRUNCATION);
@@ -31728,6 +31748,38 @@ produce_special_glyphs (struct it *it, enum display_element_type what)
31728 it->nglyphs = temp_it.nglyphs; 31748 it->nglyphs = temp_it.nglyphs;
31729} 31749}
31730 31750
31751/* Produce padding glyphs for mode/header/tab-line whose text needs to
31752 be truncated. This is used when the last visible character leaves
31753 one or more columns till the window edge, but the next character is
31754 wider than that number of columns, and therefore cannot fit on the
31755 line. We then replace these columns with the appropriate padding
31756 character: '-' for the mode line and SPC for the other two. That's
31757 because these lines should not show the usual truncation glyphs
31758 there. This function is only used on TTY frames. */
31759static void
31760pad_mode_line (struct it *it, bool mode_line_p)
31761{
31762 struct it temp_it;
31763 GLYPH glyph;
31764
31765 eassert (!FRAME_WINDOW_P (it->f));
31766 temp_it = *it;
31767 temp_it.object = Qnil;
31768 memset (&temp_it.current, 0, sizeof temp_it.current);
31769
31770 SET_GLYPH (glyph, mode_line_p ? '-' : ' ', it->base_face_id);
31771
31772 temp_it.dp = NULL;
31773 temp_it.what = IT_CHARACTER;
31774 temp_it.c = temp_it.char_to_display = GLYPH_CHAR (glyph);
31775 temp_it.face_id = GLYPH_FACE (glyph);
31776 temp_it.len = CHAR_BYTES (temp_it.c);
31777
31778 PRODUCE_GLYPHS (&temp_it);
31779 it->pixel_width = temp_it.pixel_width;
31780 it->nglyphs = temp_it.nglyphs;
31781}
31782
31731#ifdef HAVE_WINDOW_SYSTEM 31783#ifdef HAVE_WINDOW_SYSTEM
31732 31784
31733/* Calculate line-height and line-spacing properties. 31785/* Calculate line-height and line-spacing properties.