comparison src/ex_getln.c @ 507:a1059cda45f2 v7.0142

updated for version 7.0142
author vimboss
date Tue, 06 Sep 2005 19:25:11 +0000
parents 52e76e2b5b65
children b47114409935
comparison
equal deleted inserted replaced
506:3d386838cf56 507:a1059cda45f2
2367 2367
2368 /* 2368 /*
2369 * Do arabic shaping into a temporary buffer. This is very 2369 * Do arabic shaping into a temporary buffer. This is very
2370 * inefficient! 2370 * inefficient!
2371 */ 2371 */
2372 if (len * 2 > buflen) 2372 if (len * 2 + 2 > buflen)
2373 { 2373 {
2374 /* Re-allocate the buffer. We keep it around to avoid a lot of 2374 /* Re-allocate the buffer. We keep it around to avoid a lot of
2375 * alloc()/free() calls. */ 2375 * alloc()/free() calls. */
2376 vim_free(arshape_buf); 2376 vim_free(arshape_buf);
2377 buflen = len * 2; 2377 buflen = len * 2 + 2;
2378 arshape_buf = alloc(buflen); 2378 arshape_buf = alloc(buflen);
2379 if (arshape_buf == NULL) 2379 if (arshape_buf == NULL)
2380 return; /* out of memory */ 2380 return; /* out of memory */
2381 }
2382
2383 if (utf_iscomposing(utf_ptr2char(ccline.cmdbuff + start)))
2384 {
2385 /* Prepend a space to draw the leading composing char on. */
2386 arshape_buf[0] = ' ';
2387 newlen = 1;
2381 } 2388 }
2382 2389
2383 for (j = start; j < start + len; j += mb_l) 2390 for (j = start; j < start + len; j += mb_l)
2384 { 2391 {
2385 p = ccline.cmdbuff + j; 2392 p = ccline.cmdbuff + j;