Mercurial > vim
comparison src/misc1.c @ 10642:c10f367d0dfc v8.0.0211
patch 8.0.0211: cannot build without the multi-byte feature
commit https://github.com/vim/vim/commit/560379d7ae1bace259bbc29a275e73446346ce66
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 21 22:50:00 2017 +0100
patch 8.0.0211: cannot build without the multi-byte feature
Problem: Build fails if the multi-byte feature is disabled.
Solution: Change #ifdef around ins_char_bytes.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 21 Jan 2017 23:00:04 +0100 |
parents | b726d3ea70bc |
children | bc1c7e799e6e |
comparison
equal
deleted
inserted
replaced
10641:bcd353707cfc | 10642:c10f367d0dfc |
---|---|
2175 * convert bytes to a character. | 2175 * convert bytes to a character. |
2176 */ | 2176 */ |
2177 void | 2177 void |
2178 ins_char(int c) | 2178 ins_char(int c) |
2179 { | 2179 { |
2180 char_u buf[MB_MAXBYTES + 1]; | |
2181 int n = 1; | |
2182 | |
2180 #if defined(FEAT_MBYTE) || defined(PROTO) | 2183 #if defined(FEAT_MBYTE) || defined(PROTO) |
2181 char_u buf[MB_MAXBYTES + 1]; | |
2182 int n; | |
2183 | |
2184 n = (*mb_char2bytes)(c, buf); | 2184 n = (*mb_char2bytes)(c, buf); |
2185 | 2185 |
2186 /* When "c" is 0x100, 0x200, etc. we don't want to insert a NUL byte. | 2186 /* When "c" is 0x100, 0x200, etc. we don't want to insert a NUL byte. |
2187 * Happens for CTRL-Vu9900. */ | 2187 * Happens for CTRL-Vu9900. */ |
2188 if (buf[0] == 0) | 2188 if (buf[0] == 0) |
2189 buf[0] = '\n'; | 2189 buf[0] = '\n'; |
2190 #else | |
2191 buf[0] = c; | |
2192 #endif | |
2190 | 2193 |
2191 ins_char_bytes(buf, n); | 2194 ins_char_bytes(buf, n); |
2192 } | 2195 } |
2193 | 2196 |
2194 void | 2197 void |
2195 ins_char_bytes(char_u *buf, int charlen) | 2198 ins_char_bytes(char_u *buf, int charlen) |
2196 { | 2199 { |
2197 int c = buf[0]; | 2200 int c = buf[0]; |
2198 #endif | |
2199 int newlen; /* nr of bytes inserted */ | 2201 int newlen; /* nr of bytes inserted */ |
2200 int oldlen; /* nr of bytes deleted (0 when not replacing) */ | 2202 int oldlen; /* nr of bytes deleted (0 when not replacing) */ |
2201 char_u *p; | 2203 char_u *p; |
2202 char_u *newp; | 2204 char_u *newp; |
2203 char_u *oldp; | 2205 char_u *oldp; |
2216 oldp = ml_get(lnum); | 2218 oldp = ml_get(lnum); |
2217 linelen = (int)STRLEN(oldp) + 1; | 2219 linelen = (int)STRLEN(oldp) + 1; |
2218 | 2220 |
2219 /* The lengths default to the values for when not replacing. */ | 2221 /* The lengths default to the values for when not replacing. */ |
2220 oldlen = 0; | 2222 oldlen = 0; |
2221 #ifdef FEAT_MBYTE | |
2222 newlen = charlen; | 2223 newlen = charlen; |
2223 #else | |
2224 newlen = 1; | |
2225 #endif | |
2226 | 2224 |
2227 if (State & REPLACE_FLAG) | 2225 if (State & REPLACE_FLAG) |
2228 { | 2226 { |
2229 #ifdef FEAT_VREPLACE | 2227 #ifdef FEAT_VREPLACE |
2230 if (State & VREPLACE_FLAG) | 2228 if (State & VREPLACE_FLAG) |