Mercurial > emacs
comparison src/editfns.c @ 23565:077655e1e014
(Fsubst_char_in_region): Fix previous change.
(Ftranslate_region): Fix previous change.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 28 Oct 1998 07:52:13 +0000 |
parents | e06e84c477fa |
children | 36cccf1ba0a9 |
comparison
equal
deleted
inserted
replaced
23564:6eb3e346d1fd | 23565:077655e1e014 |
---|---|
2040 replace_range (pos, pos + 1, string, | 2040 replace_range (pos, pos + 1, string, |
2041 0, 0, 1); | 2041 0, 0, 1); |
2042 pos_byte_next = CHAR_TO_BYTE (pos); | 2042 pos_byte_next = CHAR_TO_BYTE (pos); |
2043 if (pos_byte_next > pos_byte) | 2043 if (pos_byte_next > pos_byte) |
2044 /* Before combining happened. We should not increment | 2044 /* Before combining happened. We should not increment |
2045 POS because now it points the next character. */ | 2045 POS. So, to cancel the later increment of POS, |
2046 pos_byte = pos_byte_next; | 2046 decrease it now. */ |
2047 pos--; | |
2047 else | 2048 else |
2048 { | 2049 INC_POS (pos_byte_next); |
2049 pos++; | |
2050 INC_POS (pos_byte_next); | |
2051 } | |
2052 | 2050 |
2053 if (! NILP (noundo)) | 2051 if (! NILP (noundo)) |
2054 current_buffer->undo_list = tem; | 2052 current_buffer->undo_list = tem; |
2055 | 2053 |
2056 UNGCPRO; | 2054 UNGCPRO; |
2058 else | 2056 else |
2059 { | 2057 { |
2060 if (NILP (noundo)) | 2058 if (NILP (noundo)) |
2061 record_change (pos, 1); | 2059 record_change (pos, 1); |
2062 for (i = 0; i < len; i++) *p++ = tostr[i]; | 2060 for (i = 0; i < len; i++) *p++ = tostr[i]; |
2063 pos_byte = pos_byte_next; | |
2064 pos++; | |
2065 } | 2061 } |
2066 } | 2062 } |
2067 else | 2063 pos_byte = pos_byte_next; |
2068 { | 2064 pos++; |
2069 pos_byte = pos_byte_next; | |
2070 pos++; | |
2071 } | |
2072 } | 2065 } |
2073 | 2066 |
2074 if (changed) | 2067 if (changed) |
2075 signal_after_change (XINT (start), | 2068 signal_after_change (XINT (start), |
2076 XINT (end) - XINT (start), XINT (end) - XINT (start)); | 2069 XINT (end) - XINT (start), XINT (end) - XINT (start)); |
2139 replace_range (pos, pos + 1, string, | 2132 replace_range (pos, pos + 1, string, |
2140 1, 0, 1); | 2133 1, 0, 1); |
2141 pos_byte_next = CHAR_TO_BYTE (pos); | 2134 pos_byte_next = CHAR_TO_BYTE (pos); |
2142 if (pos_byte_next > pos_byte) | 2135 if (pos_byte_next > pos_byte) |
2143 /* Before combining happened. We should not | 2136 /* Before combining happened. We should not |
2144 increment POS because now it points the next | 2137 increment POS. So, to cancel the later |
2145 character. */ | 2138 increment of POS, we decrease it now. */ |
2146 pos_byte = pos_byte_next; | 2139 pos--; |
2147 else | 2140 else |
2148 { | 2141 INC_POS (pos_byte_next); |
2149 pos++; | |
2150 INC_POS (pos_byte_next); | |
2151 } | |
2152 } | 2142 } |
2153 else | 2143 else |
2154 { | 2144 { |
2155 record_change (pos, 1); | 2145 record_change (pos, 1); |
2156 *p = nc; | 2146 *p = nc; |
2157 signal_after_change (pos, 1, 1); | 2147 signal_after_change (pos, 1, 1); |
2158 pos_byte++; | |
2159 pos++; | |
2160 } | 2148 } |
2161 ++cnt; | 2149 ++cnt; |
2162 } | 2150 } |
2163 else | |
2164 { | |
2165 pos_byte++; | |
2166 pos++; | |
2167 } | |
2168 } | 2151 } |
2169 else | 2152 pos_byte = pos_byte_next; |
2170 { | 2153 pos++; |
2171 pos_byte += len; | |
2172 pos++; | |
2173 } | |
2174 } | 2154 } |
2175 | 2155 |
2176 return make_number (cnt); | 2156 return make_number (cnt); |
2177 } | 2157 } |
2178 | 2158 |