diff options
| author | Kenichi Handa | 2001-01-19 05:23:16 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2001-01-19 05:23:16 +0000 |
| commit | d26b89b8119a012726fd16f0660d54cf65a2e8bc (patch) | |
| tree | d36ee83d5714fbf362c5a4b45c56f6e2afa35986 /src | |
| parent | 2d75794b0e9aac019851b45e1a5b2bfe6801f5d3 (diff) | |
| download | emacs-d26b89b8119a012726fd16f0660d54cf65a2e8bc.tar.gz emacs-d26b89b8119a012726fd16f0660d54cf65a2e8bc.zip | |
(store_frame_title): Pay attention to width of non-ASCII
characters by calling c_string_width.
(x_consider_frame_title): Get byte length of frame tile string
correctly.
(display_mode_element): Pay attention to width of non-ASCII
characters by calling strwidth.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 2354eaa6209..145dcbac00a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -6759,12 +6759,12 @@ store_frame_title_char (c) | |||
| 6759 | 6759 | ||
| 6760 | 6760 | ||
| 6761 | /* Store part of a frame title in frame_title_buf, beginning at | 6761 | /* Store part of a frame title in frame_title_buf, beginning at |
| 6762 | frame_title_ptr. STR is the string to store. Do not copy more | 6762 | frame_title_ptr. STR is the string to store. Do not copy |
| 6763 | than PRECISION number of bytes from STR; PRECISION <= 0 means copy | 6763 | characters that yield more columns than PRECISION; PRECISION <= 0 |
| 6764 | the whole string. Pad with spaces until FIELD_WIDTH number of | 6764 | means copy the whole string. Pad with spaces until FIELD_WIDTH |
| 6765 | characters have been copied; FIELD_WIDTH <= 0 means don't pad. | 6765 | number of characters have been copied; FIELD_WIDTH <= 0 means don't |
| 6766 | Called from display_mode_element when it is used to build a frame | 6766 | pad. Called from display_mode_element when it is used to build a |
| 6767 | title. */ | 6767 | frame title. */ |
| 6768 | 6768 | ||
| 6769 | static int | 6769 | static int |
| 6770 | store_frame_title (str, field_width, precision) | 6770 | store_frame_title (str, field_width, precision) |
| @@ -6772,14 +6772,13 @@ store_frame_title (str, field_width, precision) | |||
| 6772 | int field_width, precision; | 6772 | int field_width, precision; |
| 6773 | { | 6773 | { |
| 6774 | int n = 0; | 6774 | int n = 0; |
| 6775 | int dummy, nbytes, width; | ||
| 6775 | 6776 | ||
| 6776 | /* Copy at most PRECISION chars from STR. */ | 6777 | /* Copy at most PRECISION chars from STR. */ |
| 6777 | while ((precision <= 0 || n < precision) | 6778 | nbytes = strlen (str); |
| 6778 | && *str) | 6779 | n+= c_string_width (str, nbytes, precision, &dummy, &nbytes); |
| 6779 | { | 6780 | while (nbytes--) |
| 6780 | store_frame_title_char (*str++); | 6781 | store_frame_title_char (*str++); |
| 6781 | ++n; | ||
| 6782 | } | ||
| 6783 | 6782 | ||
| 6784 | /* Fill up with spaces until FIELD_WIDTH reached. */ | 6783 | /* Fill up with spaces until FIELD_WIDTH reached. */ |
| 6785 | while (field_width > 0 | 6784 | while (field_width > 0 |
| @@ -6837,7 +6836,8 @@ x_consider_frame_title (frame) | |||
| 6837 | frame_title_ptr = frame_title_buf; | 6836 | frame_title_ptr = frame_title_buf; |
| 6838 | init_iterator (&it, XWINDOW (f->selected_window), -1, -1, | 6837 | init_iterator (&it, XWINDOW (f->selected_window), -1, -1, |
| 6839 | NULL, DEFAULT_FACE_ID); | 6838 | NULL, DEFAULT_FACE_ID); |
| 6840 | len = display_mode_element (&it, 0, -1, -1, fmt); | 6839 | display_mode_element (&it, 0, -1, -1, fmt); |
| 6840 | len = frame_title_ptr - frame_title_buf; | ||
| 6841 | frame_title_ptr = NULL; | 6841 | frame_title_ptr = NULL; |
| 6842 | set_buffer_internal (obuf); | 6842 | set_buffer_internal (obuf); |
| 6843 | 6843 | ||
| @@ -12804,12 +12804,13 @@ display_mode_element (it, depth, field_width, precision, elt) | |||
| 12804 | /* Output to end of string or up to '%'. Field width | 12804 | /* Output to end of string or up to '%'. Field width |
| 12805 | is length of string. Don't output more than | 12805 | is length of string. Don't output more than |
| 12806 | PRECISION allows us. */ | 12806 | PRECISION allows us. */ |
| 12807 | prec = --this - last; | 12807 | --this; |
| 12808 | prec = strwidth (last, this - last); | ||
| 12808 | if (precision > 0 && prec > precision - n) | 12809 | if (precision > 0 && prec > precision - n) |
| 12809 | prec = precision - n; | 12810 | prec = precision - n; |
| 12810 | 12811 | ||
| 12811 | if (frame_title_ptr) | 12812 | if (frame_title_ptr) |
| 12812 | n += store_frame_title (last, prec, prec); | 12813 | n += store_frame_title (last, 0, prec); |
| 12813 | else | 12814 | else |
| 12814 | n += display_string (NULL, elt, Qnil, 0, last - lisp_string, | 12815 | n += display_string (NULL, elt, Qnil, 0, last - lisp_string, |
| 12815 | it, 0, prec, 0, -1); | 12816 | it, 0, prec, 0, -1); |
| @@ -12891,9 +12892,7 @@ display_mode_element (it, depth, field_width, precision, elt) | |||
| 12891 | don't check for % within it. */ | 12892 | don't check for % within it. */ |
| 12892 | if (STRINGP (tem)) | 12893 | if (STRINGP (tem)) |
| 12893 | { | 12894 | { |
| 12894 | prec = XSTRING (tem)->size; | 12895 | prec = precision - n; |
| 12895 | if (precision > 0 && prec > precision - n) | ||
| 12896 | prec = precision - n; | ||
| 12897 | if (frame_title_ptr) | 12896 | if (frame_title_ptr) |
| 12898 | n += store_frame_title (XSTRING (tem)->data, -1, prec); | 12897 | n += store_frame_title (XSTRING (tem)->data, -1, prec); |
| 12899 | else | 12898 | else |