diff options
| author | Lars Ingebrigtsen | 2020-12-29 05:16:25 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2020-12-29 05:16:25 +0100 |
| commit | 03bab768bee56377677b5ff0e49c4cd03972a01a (patch) | |
| tree | 3c85592925b15e14eb3f0521fdf616e6ae162827 /src | |
| parent | a66f0d3bd3486b7253f482b7169b0de2d0d49c79 (diff) | |
| download | emacs-03bab768bee56377677b5ff0e49c4cd03972a01a.tar.gz emacs-03bab768bee56377677b5ff0e49c4cd03972a01a.zip | |
Add a parameter to display_string to allow not ignoring text props
* src/xdisp.c (display_string): Add a parameter to allow not
ignoring text properties (bug#45520). Adjust callers throughout
xdisp.c.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 6606e49e428..f7b87dcce18 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1114,7 +1114,8 @@ static ptrdiff_t display_count_lines (ptrdiff_t, ptrdiff_t, ptrdiff_t, | |||
| 1114 | static void pint2str (register char *, register int, register ptrdiff_t); | 1114 | static void pint2str (register char *, register int, register ptrdiff_t); |
| 1115 | 1115 | ||
| 1116 | static int display_string (const char *, Lisp_Object, Lisp_Object, | 1116 | static int display_string (const char *, Lisp_Object, Lisp_Object, |
| 1117 | ptrdiff_t, ptrdiff_t, struct it *, int, int, int, int); | 1117 | ptrdiff_t, ptrdiff_t, struct it *, int, int, int, |
| 1118 | int, bool); | ||
| 1118 | static void compute_line_metrics (struct it *); | 1119 | static void compute_line_metrics (struct it *); |
| 1119 | static void run_redisplay_end_trigger_hook (struct it *); | 1120 | static void run_redisplay_end_trigger_hook (struct it *); |
| 1120 | static bool get_overlay_strings (struct it *, ptrdiff_t); | 1121 | static bool get_overlay_strings (struct it *, ptrdiff_t); |
| @@ -13154,12 +13155,13 @@ display_tab_bar (struct window *w) | |||
| 13154 | 13155 | ||
| 13155 | if (it.current_x < it.last_visible_x) | 13156 | if (it.current_x < it.last_visible_x) |
| 13156 | display_string (NULL, string, Qnil, 0, 0, &it, | 13157 | display_string (NULL, string, Qnil, 0, 0, &it, |
| 13157 | SCHARS (string), 0, 0, STRING_MULTIBYTE (string)); | 13158 | SCHARS (string), 0, 0, STRING_MULTIBYTE (string), |
| 13159 | TRUE); | ||
| 13158 | } | 13160 | } |
| 13159 | 13161 | ||
| 13160 | /* Fill out the line with spaces. */ | 13162 | /* Fill out the line with spaces. */ |
| 13161 | if (it.current_x < it.last_visible_x) | 13163 | if (it.current_x < it.last_visible_x) |
| 13162 | display_string ("", Qnil, Qnil, 0, 0, &it, -1, 0, 0, -1); | 13164 | display_string ("", Qnil, Qnil, 0, 0, &it, -1, 0, 0, -1, TRUE); |
| 13163 | 13165 | ||
| 13164 | /* Compute the total height of the lines. */ | 13166 | /* Compute the total height of the lines. */ |
| 13165 | compute_line_metrics (&it); | 13167 | compute_line_metrics (&it); |
| @@ -25136,12 +25138,13 @@ display_menu_bar (struct window *w) | |||
| 25136 | /* Display the item, pad with one space. */ | 25138 | /* Display the item, pad with one space. */ |
| 25137 | if (it.current_x < it.last_visible_x) | 25139 | if (it.current_x < it.last_visible_x) |
| 25138 | display_string (NULL, string, Qnil, 0, 0, &it, | 25140 | display_string (NULL, string, Qnil, 0, 0, &it, |
| 25139 | SCHARS (string) + 1, 0, 0, STRING_MULTIBYTE (string)); | 25141 | SCHARS (string) + 1, 0, 0, STRING_MULTIBYTE (string), |
| 25142 | TRUE); | ||
| 25140 | } | 25143 | } |
| 25141 | 25144 | ||
| 25142 | /* Fill out the line with spaces. */ | 25145 | /* Fill out the line with spaces. */ |
| 25143 | if (it.current_x < it.last_visible_x) | 25146 | if (it.current_x < it.last_visible_x) |
| 25144 | display_string ("", Qnil, Qnil, 0, 0, &it, -1, 0, 0, -1); | 25147 | display_string ("", Qnil, Qnil, 0, 0, &it, -1, 0, 0, -1, TRUE); |
| 25145 | 25148 | ||
| 25146 | /* Compute the total height of the lines. */ | 25149 | /* Compute the total height of the lines. */ |
| 25147 | compute_line_metrics (&it); | 25150 | compute_line_metrics (&it); |
| @@ -25245,21 +25248,22 @@ display_tty_menu_item (const char *item_text, int width, int face_id, | |||
| 25245 | it.paragraph_embedding = L2R; | 25248 | it.paragraph_embedding = L2R; |
| 25246 | 25249 | ||
| 25247 | /* Pad with a space on the left. */ | 25250 | /* Pad with a space on the left. */ |
| 25248 | display_string (" ", Qnil, Qnil, 0, 0, &it, 1, 0, FRAME_COLS (f) - 1, -1); | 25251 | display_string (" ", Qnil, Qnil, 0, 0, &it, 1, 0, FRAME_COLS (f) - 1, -1, |
| 25252 | TRUE); | ||
| 25249 | width--; | 25253 | width--; |
| 25250 | /* Display the menu item, pad with spaces to WIDTH. */ | 25254 | /* Display the menu item, pad with spaces to WIDTH. */ |
| 25251 | if (submenu) | 25255 | if (submenu) |
| 25252 | { | 25256 | { |
| 25253 | display_string (item_text, Qnil, Qnil, 0, 0, &it, | 25257 | display_string (item_text, Qnil, Qnil, 0, 0, &it, |
| 25254 | item_len, 0, FRAME_COLS (f) - 1, -1); | 25258 | item_len, 0, FRAME_COLS (f) - 1, -1, TRUE); |
| 25255 | width -= item_len; | 25259 | width -= item_len; |
| 25256 | /* Indicate with " >" that there's a submenu. */ | 25260 | /* Indicate with " >" that there's a submenu. */ |
| 25257 | display_string (" >", Qnil, Qnil, 0, 0, &it, width, 0, | 25261 | display_string (" >", Qnil, Qnil, 0, 0, &it, width, 0, |
| 25258 | FRAME_COLS (f) - 1, -1); | 25262 | FRAME_COLS (f) - 1, -1, TRUE); |
| 25259 | } | 25263 | } |
| 25260 | else | 25264 | else |
| 25261 | display_string (item_text, Qnil, Qnil, 0, 0, &it, | 25265 | display_string (item_text, Qnil, Qnil, 0, 0, &it, |
| 25262 | width, 0, FRAME_COLS (f) - 1, -1); | 25266 | width, 0, FRAME_COLS (f) - 1, -1, TRUE); |
| 25263 | 25267 | ||
| 25264 | row->used[TEXT_AREA] = max (saved_used, row->used[TEXT_AREA]); | 25268 | row->used[TEXT_AREA] = max (saved_used, row->used[TEXT_AREA]); |
| 25265 | row->truncated_on_right_p = saved_truncated; | 25269 | row->truncated_on_right_p = saved_truncated; |
| @@ -25469,8 +25473,9 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format) | |||
| 25469 | && window_body_width (XWINDOW (selected_window), FALSE) >= | 25473 | && window_body_width (XWINDOW (selected_window), FALSE) >= |
| 25470 | SCHARS (mode_string)) | 25474 | SCHARS (mode_string)) |
| 25471 | { | 25475 | { |
| 25472 | display_string (SSDATA (mode_string), Qnil, Qnil, 0, 0, &it, 0, 0, 0, | 25476 | display_string (SSDATA (mode_string), mode_string, Qnil, |
| 25473 | STRING_MULTIBYTE (mode_string)); | 25477 | 0, 0, &it, 0, 0, 0, |
| 25478 | STRING_MULTIBYTE (mode_string), FALSE); | ||
| 25474 | } | 25479 | } |
| 25475 | else | 25480 | else |
| 25476 | { | 25481 | { |
| @@ -25490,7 +25495,7 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format) | |||
| 25490 | *s = 0; | 25495 | *s = 0; |
| 25491 | 25496 | ||
| 25492 | display_string (string, Qnil, Qnil, 0, 0, &it, 0, 0, 0, | 25497 | display_string (string, Qnil, Qnil, 0, 0, &it, 0, 0, 0, |
| 25493 | STRING_MULTIBYTE (mode_string)); | 25498 | STRING_MULTIBYTE (mode_string), TRUE); |
| 25494 | xfree (string); | 25499 | xfree (string); |
| 25495 | } | 25500 | } |
| 25496 | } | 25501 | } |
| @@ -25499,7 +25504,7 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format) | |||
| 25499 | unbind_to (count, Qnil); | 25504 | unbind_to (count, Qnil); |
| 25500 | 25505 | ||
| 25501 | /* Fill up with spaces. */ | 25506 | /* Fill up with spaces. */ |
| 25502 | display_string (" ", Qnil, Qnil, 0, 0, &it, 10000, -1, -1, 0); | 25507 | display_string (" ", Qnil, Qnil, 0, 0, &it, 10000, -1, -1, 0, TRUE); |
| 25503 | 25508 | ||
| 25504 | compute_line_metrics (&it); | 25509 | compute_line_metrics (&it); |
| 25505 | it.glyph_row->full_width_p = true; | 25510 | it.glyph_row->full_width_p = true; |
| @@ -25703,7 +25708,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, | |||
| 25703 | break; | 25708 | break; |
| 25704 | case MODE_LINE_DISPLAY: | 25709 | case MODE_LINE_DISPLAY: |
| 25705 | n += display_string (NULL, elt, Qnil, 0, 0, it, | 25710 | n += display_string (NULL, elt, Qnil, 0, 0, it, |
| 25706 | 0, prec, 0, STRING_MULTIBYTE (elt)); | 25711 | 0, prec, 0, STRING_MULTIBYTE (elt), TRUE); |
| 25707 | break; | 25712 | break; |
| 25708 | } | 25713 | } |
| 25709 | 25714 | ||
| @@ -25765,7 +25770,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, | |||
| 25765 | nchars = string_byte_to_char (elt, offset) - charpos; | 25770 | nchars = string_byte_to_char (elt, offset) - charpos; |
| 25766 | n += display_string (NULL, elt, Qnil, 0, charpos, | 25771 | n += display_string (NULL, elt, Qnil, 0, charpos, |
| 25767 | it, 0, nchars, 0, | 25772 | it, 0, nchars, 0, |
| 25768 | STRING_MULTIBYTE (elt)); | 25773 | STRING_MULTIBYTE (elt), TRUE); |
| 25769 | } | 25774 | } |
| 25770 | break; | 25775 | break; |
| 25771 | } | 25776 | } |
| @@ -25837,7 +25842,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, | |||
| 25837 | nwritten = display_string (spec, string, elt, | 25842 | nwritten = display_string (spec, string, elt, |
| 25838 | charpos, 0, it, | 25843 | charpos, 0, it, |
| 25839 | field, prec, 0, | 25844 | field, prec, 0, |
| 25840 | multibyte); | 25845 | multibyte, TRUE); |
| 25841 | 25846 | ||
| 25842 | /* Assign to the glyphs written above the | 25847 | /* Assign to the glyphs written above the |
| 25843 | string where the `%x' came from, position | 25848 | string where the `%x' came from, position |
| @@ -26044,7 +26049,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, | |||
| 26044 | break; | 26049 | break; |
| 26045 | case MODE_LINE_DISPLAY: | 26050 | case MODE_LINE_DISPLAY: |
| 26046 | n += display_string ("", Qnil, Qnil, 0, 0, it, field_width - n, | 26051 | n += display_string ("", Qnil, Qnil, 0, 0, it, field_width - n, |
| 26047 | 0, 0, 0); | 26052 | 0, 0, 0, TRUE); |
| 26048 | break; | 26053 | break; |
| 26049 | } | 26054 | } |
| 26050 | } | 26055 | } |
| @@ -27114,7 +27119,8 @@ display_count_lines (ptrdiff_t start_byte, | |||
| 27114 | static int | 27119 | static int |
| 27115 | display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_string, | 27120 | display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_string, |
| 27116 | ptrdiff_t face_string_pos, ptrdiff_t start, struct it *it, | 27121 | ptrdiff_t face_string_pos, ptrdiff_t start, struct it *it, |
| 27117 | int field_width, int precision, int max_x, int multibyte) | 27122 | int field_width, int precision, int max_x, int multibyte, |
| 27123 | bool ignore_text_properties) | ||
| 27118 | { | 27124 | { |
| 27119 | int hpos_at_start = it->hpos; | 27125 | int hpos_at_start = it->hpos; |
| 27120 | int saved_face_id = it->face_id; | 27126 | int saved_face_id = it->face_id; |
| @@ -27125,7 +27131,8 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st | |||
| 27125 | with index START. */ | 27131 | with index START. */ |
| 27126 | reseat_to_string (it, NILP (lisp_string) ? string : NULL, lisp_string, | 27132 | reseat_to_string (it, NILP (lisp_string) ? string : NULL, lisp_string, |
| 27127 | start, precision, field_width, multibyte); | 27133 | start, precision, field_width, multibyte); |
| 27128 | if (string && STRINGP (lisp_string)) | 27134 | |
| 27135 | if (string && STRINGP (lisp_string) && ignore_text_properties) | ||
| 27129 | /* LISP_STRING is the one returned by decode_mode_spec. We should | 27136 | /* LISP_STRING is the one returned by decode_mode_spec. We should |
| 27130 | ignore its text properties. */ | 27137 | ignore its text properties. */ |
| 27131 | it->stop_charpos = it->end_charpos; | 27138 | it->stop_charpos = it->end_charpos; |