diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index dbce1c56368..306e26702f5 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -7976,7 +7976,7 @@ store_frame_title (str, field_width, precision) | |||
| 7976 | 7976 | ||
| 7977 | /* Copy at most PRECISION chars from STR. */ | 7977 | /* Copy at most PRECISION chars from STR. */ |
| 7978 | nbytes = strlen (str); | 7978 | nbytes = strlen (str); |
| 7979 | n+= c_string_width (str, nbytes, precision, &dummy, &nbytes); | 7979 | n += c_string_width (str, nbytes, precision, &dummy, &nbytes); |
| 7980 | while (nbytes--) | 7980 | while (nbytes--) |
| 7981 | store_frame_title_char (*str++); | 7981 | store_frame_title_char (*str++); |
| 7982 | 7982 | ||
| @@ -15457,14 +15457,15 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky) | |||
| 15457 | 15457 | ||
| 15458 | if (this - 1 != last) | 15458 | if (this - 1 != last) |
| 15459 | { | 15459 | { |
| 15460 | int nchars, nbytes; | ||
| 15461 | |||
| 15460 | /* Output to end of string or up to '%'. Field width | 15462 | /* Output to end of string or up to '%'. Field width |
| 15461 | is length of string. Don't output more than | 15463 | is length of string. Don't output more than |
| 15462 | PRECISION allows us. */ | 15464 | PRECISION allows us. */ |
| 15463 | --this; | 15465 | --this; |
| 15464 | 15466 | ||
| 15465 | prec = chars_in_text (last, this - last); | 15467 | prec = c_string_width (last, this - last, precision - n, |
| 15466 | if (precision > 0 && prec > precision - n) | 15468 | &nchars, &nbytes); |
| 15467 | prec = precision - n; | ||
| 15468 | 15469 | ||
| 15469 | if (frame_title_ptr) | 15470 | if (frame_title_ptr) |
| 15470 | n += store_frame_title (last, 0, prec); | 15471 | n += store_frame_title (last, 0, prec); |
| @@ -15472,9 +15473,12 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky) | |||
| 15472 | { | 15473 | { |
| 15473 | int bytepos = last - lisp_string; | 15474 | int bytepos = last - lisp_string; |
| 15474 | int charpos = string_byte_to_char (elt, bytepos); | 15475 | int charpos = string_byte_to_char (elt, bytepos); |
| 15476 | int endpos = (precision <= 0 ? SCHARS (elt) | ||
| 15477 | : charpos + nchars); | ||
| 15478 | |||
| 15475 | n += store_mode_line_string (NULL, | 15479 | n += store_mode_line_string (NULL, |
| 15476 | Fsubstring (elt, make_number (charpos), | 15480 | Fsubstring (elt, make_number (charpos), |
| 15477 | make_number (charpos + prec)), | 15481 | make_number (endpos)), |
| 15478 | 0, 0, 0, Qnil); | 15482 | 0, 0, 0, Qnil); |
| 15479 | } | 15483 | } |
| 15480 | else | 15484 | else |