aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
authorKenichi Handa1998-10-28 07:52:13 +0000
committerKenichi Handa1998-10-28 07:52:13 +0000
commit3f5409d35bb98c63ce460bac3ca41a8377a49f36 (patch)
treef3a533f91ce6e131a79dab4be2c821acf97f29f1 /src/editfns.c
parentd14d03ac4a6509099810cc24f3ea3f57a27c7e6b (diff)
downloademacs-3f5409d35bb98c63ce460bac3ca41a8377a49f36.tar.gz
emacs-3f5409d35bb98c63ce460bac3ca41a8377a49f36.zip
(Fsubst_char_in_region): Fix previous change.
(Ftranslate_region): Fix previous change.
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c44
1 files changed, 12 insertions, 32 deletions
diff --git a/src/editfns.c b/src/editfns.c
index b6302ca05f2..67758db088b 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2042,13 +2042,11 @@ Both characters must have the same length of multi-byte form.")
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;
@@ -2060,15 +2058,10 @@ Both characters must have the same length of multi-byte form.")
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)
@@ -2141,36 +2134,23 @@ It returns the number of characters changed.")
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 }
2169 else
2170 {
2171 pos_byte += len;
2172 pos++;
2173 } 2151 }
2152 pos_byte = pos_byte_next;
2153 pos++;
2174 } 2154 }
2175 2155
2176 return make_number (cnt); 2156 return make_number (cnt);