Mercurial > emacs
comparison src/xdisp.c @ 90228:fa0da9b57058
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-82
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 542-553)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 116-121)
- Merge from emacs--cvs-trunk--0
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 19 Sep 2005 10:20:33 +0000 |
parents | 10fe5fadaf89 b695b0dc3532 |
children | ee12d75eb214 |
comparison
equal
deleted
inserted
replaced
90227:10fe5fadaf89 | 90228:fa0da9b57058 |
---|---|
4901 if (it->selective > 0) | 4901 if (it->selective > 0) |
4902 while (IT_CHARPOS (*it) < ZV | 4902 while (IT_CHARPOS (*it) < ZV |
4903 && indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it), | 4903 && indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it), |
4904 (double) it->selective)) /* iftc */ | 4904 (double) it->selective)) /* iftc */ |
4905 { | 4905 { |
4906 xassert (FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n'); | 4906 xassert (IT_BYTEPOS (*it) == BEGV |
4907 || FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n'); | |
4907 newline_found_p = forward_to_next_line_start (it, &skipped_p); | 4908 newline_found_p = forward_to_next_line_start (it, &skipped_p); |
4908 } | 4909 } |
4909 | 4910 |
4910 /* Position on the newline if that's what's requested. */ | 4911 /* Position on the newline if that's what's requested. */ |
4911 if (on_newline_p && newline_found_p) | 4912 if (on_newline_p && newline_found_p) |
6627 TRACE_MOVE ((stderr, "move_it_v: to %d\n", IT_CHARPOS (*it))); | 6628 TRACE_MOVE ((stderr, "move_it_v: to %d\n", IT_CHARPOS (*it))); |
6628 | 6629 |
6629 /* If buffer ends in ZV without a newline, move to the start of | 6630 /* If buffer ends in ZV without a newline, move to the start of |
6630 the line to satisfy the post-condition. */ | 6631 the line to satisfy the post-condition. */ |
6631 if (IT_CHARPOS (*it) == ZV | 6632 if (IT_CHARPOS (*it) == ZV |
6633 && ZV > BEGV | |
6632 && FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n') | 6634 && FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n') |
6633 move_it_by_lines (it, 0, 0); | 6635 move_it_by_lines (it, 0, 0); |
6634 } | 6636 } |
6635 } | 6637 } |
6636 | 6638 |
7164 cancel_echoing (); | 7166 cancel_echoing (); |
7165 | 7167 |
7166 /* First flush out any partial line written with print. */ | 7168 /* First flush out any partial line written with print. */ |
7167 message_log_maybe_newline (); | 7169 message_log_maybe_newline (); |
7168 if (STRINGP (m)) | 7170 if (STRINGP (m)) |
7169 message_dolog (SDATA (m), nbytes, 1, multibyte); | 7171 { |
7172 char *buffer; | |
7173 USE_SAFE_ALLOCA; | |
7174 | |
7175 SAFE_ALLOCA (buffer, char *, nbytes); | |
7176 bcopy (SDATA (m), buffer, nbytes); | |
7177 message_dolog (buffer, nbytes, 1, multibyte); | |
7178 SAFE_FREE (); | |
7179 } | |
7170 message3_nolog (m, nbytes, multibyte); | 7180 message3_nolog (m, nbytes, multibyte); |
7171 | 7181 |
7172 UNGCPRO; | 7182 UNGCPRO; |
7173 } | 7183 } |
7174 | 7184 |
10113 && (MATRIX_ROW_START_CHARPOS (row) == marker_position (val))) | 10123 && (MATRIX_ROW_START_CHARPOS (row) == marker_position (val))) |
10114 { | 10124 { |
10115 if (FRAME_WINDOW_P (it->f) | 10125 if (FRAME_WINDOW_P (it->f) |
10116 && WINDOW_LEFT_FRINGE_WIDTH (it->w) > 0) | 10126 && WINDOW_LEFT_FRINGE_WIDTH (it->w) > 0) |
10117 { | 10127 { |
10128 #ifdef HAVE_WINDOW_SYSTEM | |
10118 if (val = Fget (var, Qoverlay_arrow_bitmap), SYMBOLP (val)) | 10129 if (val = Fget (var, Qoverlay_arrow_bitmap), SYMBOLP (val)) |
10119 { | 10130 { |
10120 int fringe_bitmap; | 10131 int fringe_bitmap; |
10121 if ((fringe_bitmap = lookup_fringe_bitmap (val)) != 0) | 10132 if ((fringe_bitmap = lookup_fringe_bitmap (val)) != 0) |
10122 return make_number (fringe_bitmap); | 10133 return make_number (fringe_bitmap); |
10123 } | 10134 } |
10135 #endif | |
10124 return make_number (-1); /* Use default arrow bitmap */ | 10136 return make_number (-1); /* Use default arrow bitmap */ |
10125 } | 10137 } |
10126 return overlay_arrow_string_or_property (var); | 10138 return overlay_arrow_string_or_property (var); |
10127 } | 10139 } |
10128 } | 10140 } |
16042 { | 16054 { |
16043 case Lisp_String: | 16055 case Lisp_String: |
16044 { | 16056 { |
16045 /* A string: output it and check for %-constructs within it. */ | 16057 /* A string: output it and check for %-constructs within it. */ |
16046 unsigned char c; | 16058 unsigned char c; |
16047 const unsigned char *this, *lisp_string; | 16059 int offset = 0; |
16048 | 16060 |
16049 if (!NILP (props) || risky) | 16061 if (!NILP (props) || risky) |
16050 { | 16062 { |
16051 Lisp_Object oprops, aelt; | 16063 Lisp_Object oprops, aelt; |
16052 oprops = Ftext_properties_at (make_number (0), elt); | 16064 oprops = Ftext_properties_at (make_number (0), elt); |
16100 XSETCDR (tem, Qnil); | 16112 XSETCDR (tem, Qnil); |
16101 } | 16113 } |
16102 } | 16114 } |
16103 } | 16115 } |
16104 | 16116 |
16105 this = SDATA (elt); | 16117 offset = 0; |
16106 lisp_string = this; | |
16107 | 16118 |
16108 if (literal) | 16119 if (literal) |
16109 { | 16120 { |
16110 prec = precision - n; | 16121 prec = precision - n; |
16111 switch (mode_line_target) | 16122 switch (mode_line_target) |
16124 } | 16135 } |
16125 | 16136 |
16126 break; | 16137 break; |
16127 } | 16138 } |
16128 | 16139 |
16140 /* Handle the non-literal case. */ | |
16141 | |
16129 while ((precision <= 0 || n < precision) | 16142 while ((precision <= 0 || n < precision) |
16130 && *this | 16143 && SREF (elt, offset) != 0 |
16131 && (mode_line_target != MODE_LINE_DISPLAY | 16144 && (mode_line_target != MODE_LINE_DISPLAY |
16132 || it->current_x < it->last_visible_x)) | 16145 || it->current_x < it->last_visible_x)) |
16133 { | 16146 { |
16134 const unsigned char *last = this; | 16147 int last_offset = offset; |
16135 | 16148 |
16136 /* Advance to end of string or next format specifier. */ | 16149 /* Advance to end of string or next format specifier. */ |
16137 while ((c = *this++) != '\0' && c != '%') | 16150 while ((c = SREF (elt, offset++)) != '\0' && c != '%') |
16138 ; | 16151 ; |
16139 | 16152 |
16140 if (this - 1 != last) | 16153 if (offset - 1 != last_offset) |
16141 { | 16154 { |
16142 int nchars, nbytes; | 16155 int nchars, nbytes; |
16143 | 16156 |
16144 /* Output to end of string or up to '%'. Field width | 16157 /* Output to end of string or up to '%'. Field width |
16145 is length of string. Don't output more than | 16158 is length of string. Don't output more than |
16146 PRECISION allows us. */ | 16159 PRECISION allows us. */ |
16147 --this; | 16160 offset--; |
16148 | 16161 |
16149 prec = c_string_width (last, this - last, precision - n, | 16162 prec = c_string_width (SDATA (elt) + last_offset, |
16163 offset - last_offset, precision - n, | |
16150 &nchars, &nbytes); | 16164 &nchars, &nbytes); |
16151 | 16165 |
16152 switch (mode_line_target) | 16166 switch (mode_line_target) |
16153 { | 16167 { |
16154 case MODE_LINE_NOPROP: | 16168 case MODE_LINE_NOPROP: |
16155 case MODE_LINE_TITLE: | 16169 case MODE_LINE_TITLE: |
16156 n += store_mode_line_noprop (last, 0, prec); | 16170 n += store_mode_line_noprop (SDATA (elt) + last_offset, 0, prec); |
16157 break; | 16171 break; |
16158 case MODE_LINE_STRING: | 16172 case MODE_LINE_STRING: |
16159 { | 16173 { |
16160 int bytepos = last - lisp_string; | 16174 int bytepos = last_offset; |
16161 int charpos = string_byte_to_char (elt, bytepos); | 16175 int charpos = string_byte_to_char (elt, bytepos); |
16162 int endpos = (precision <= 0 | 16176 int endpos = (precision <= 0 |
16163 ? string_byte_to_char (elt, | 16177 ? string_byte_to_char (elt, offset) |
16164 this - lisp_string) | |
16165 : charpos + nchars); | 16178 : charpos + nchars); |
16166 | 16179 |
16167 n += store_mode_line_string (NULL, | 16180 n += store_mode_line_string (NULL, |
16168 Fsubstring (elt, make_number (charpos), | 16181 Fsubstring (elt, make_number (charpos), |
16169 make_number (endpos)), | 16182 make_number (endpos)), |
16170 0, 0, 0, Qnil); | 16183 0, 0, 0, Qnil); |
16171 } | 16184 } |
16172 break; | 16185 break; |
16173 case MODE_LINE_DISPLAY: | 16186 case MODE_LINE_DISPLAY: |
16174 { | 16187 { |
16175 int bytepos = last - lisp_string; | 16188 int bytepos = last_offset; |
16176 int charpos = string_byte_to_char (elt, bytepos); | 16189 int charpos = string_byte_to_char (elt, bytepos); |
16177 n += display_string (NULL, elt, Qnil, 0, charpos, | 16190 n += display_string (NULL, elt, Qnil, 0, charpos, |
16178 it, 0, prec, 0, | 16191 it, 0, prec, 0, |
16179 STRING_MULTIBYTE (elt)); | 16192 STRING_MULTIBYTE (elt)); |
16180 } | 16193 } |
16181 break; | 16194 break; |
16182 } | 16195 } |
16183 } | 16196 } |
16184 else /* c == '%' */ | 16197 else /* c == '%' */ |
16185 { | 16198 { |
16186 const unsigned char *percent_position = this; | 16199 int percent_position = offset; |
16187 | 16200 |
16188 /* Get the specified minimum width. Zero means | 16201 /* Get the specified minimum width. Zero means |
16189 don't pad. */ | 16202 don't pad. */ |
16190 field = 0; | 16203 field = 0; |
16191 while ((c = *this++) >= '0' && c <= '9') | 16204 while ((c = SREF (elt, offset++)) >= '0' && c <= '9') |
16192 field = field * 10 + c - '0'; | 16205 field = field * 10 + c - '0'; |
16193 | 16206 |
16194 /* Don't pad beyond the total padding allowed. */ | 16207 /* Don't pad beyond the total padding allowed. */ |
16195 if (field_width - n > 0 && field > field_width - n) | 16208 if (field_width - n > 0 && field > field_width - n) |
16196 field = field_width - n; | 16209 field = field_width - n; |
16206 { | 16219 { |
16207 int multibyte; | 16220 int multibyte; |
16208 int bytepos, charpos; | 16221 int bytepos, charpos; |
16209 unsigned char *spec; | 16222 unsigned char *spec; |
16210 | 16223 |
16211 bytepos = percent_position - lisp_string; | 16224 bytepos = percent_position; |
16212 charpos = (STRING_MULTIBYTE (elt) | 16225 charpos = (STRING_MULTIBYTE (elt) |
16213 ? string_byte_to_char (elt, bytepos) | 16226 ? string_byte_to_char (elt, bytepos) |
16214 : bytepos); | 16227 : bytepos); |
16215 | 16228 |
16216 spec | 16229 spec |