Mercurial > vim
comparison src/edit.c @ 474:a5fcf36ef512 v7.0127
updated for version 7.0127
author | vimboss |
---|---|
date | Wed, 10 Aug 2005 21:07:57 +0000 |
parents | 1ab289401940 |
children | f8b75b8f1988 |
comparison
equal
deleted
inserted
replaced
473:4a7320e53f32 | 474:a5fcf36ef512 |
---|---|
442 if (ptr[1] == NUL) | 442 if (ptr[1] == NUL) |
443 ++curwin->w_cursor.col; | 443 ++curwin->w_cursor.col; |
444 #ifdef FEAT_MBYTE | 444 #ifdef FEAT_MBYTE |
445 else if (has_mbyte) | 445 else if (has_mbyte) |
446 { | 446 { |
447 i = (*mb_ptr2len_check)(ptr); | 447 i = (*mb_ptr2len)(ptr); |
448 if (ptr[i] == NUL) | 448 if (ptr[i] == NUL) |
449 curwin->w_cursor.col += i; | 449 curwin->w_cursor.col += i; |
450 } | 450 } |
451 #endif | 451 #endif |
452 } | 452 } |
1559 while (vcol <= (int)curwin->w_virtcol) | 1559 while (vcol <= (int)curwin->w_virtcol) |
1560 { | 1560 { |
1561 last_vcol = vcol; | 1561 last_vcol = vcol; |
1562 #ifdef FEAT_MBYTE | 1562 #ifdef FEAT_MBYTE |
1563 if (has_mbyte && new_cursor_col >= 0) | 1563 if (has_mbyte && new_cursor_col >= 0) |
1564 new_cursor_col += (*mb_ptr2len_check)(ptr + new_cursor_col); | 1564 new_cursor_col += (*mb_ptr2len)(ptr + new_cursor_col); |
1565 else | 1565 else |
1566 #endif | 1566 #endif |
1567 ++new_cursor_col; | 1567 ++new_cursor_col; |
1568 vcol += lbr_chartabsize(ptr + new_cursor_col, (colnr_T)vcol); | 1568 vcol += lbr_chartabsize(ptr + new_cursor_col, (colnr_T)vcol); |
1569 } | 1569 } |
2151 /* Japanese words may have characters in | 2151 /* Japanese words may have characters in |
2152 * different classes, only separate words | 2152 * different classes, only separate words |
2153 * with single-byte non-word characters. */ | 2153 * with single-byte non-word characters. */ |
2154 while (*ptr != NUL) | 2154 while (*ptr != NUL) |
2155 { | 2155 { |
2156 int l = (*mb_ptr2len_check)(ptr); | 2156 int l = (*mb_ptr2len)(ptr); |
2157 | 2157 |
2158 if (l < 2 && !vim_iswordc(*ptr)) | 2158 if (l < 2 && !vim_iswordc(*ptr)) |
2159 break; | 2159 break; |
2160 ptr += l; | 2160 ptr += l; |
2161 } | 2161 } |
2201 char_u *ptr; | 2201 char_u *ptr; |
2202 { | 2202 { |
2203 #ifdef FEAT_MBYTE | 2203 #ifdef FEAT_MBYTE |
2204 if (has_mbyte) | 2204 if (has_mbyte) |
2205 while (*ptr != NUL && *ptr != '\n' && mb_get_class(ptr) <= 1) | 2205 while (*ptr != NUL && *ptr != '\n' && mb_get_class(ptr) <= 1) |
2206 ptr += (*mb_ptr2len_check)(ptr); | 2206 ptr += (*mb_ptr2len)(ptr); |
2207 else | 2207 else |
2208 #endif | 2208 #endif |
2209 while (*ptr != NUL && *ptr != '\n' && !vim_iswordc(*ptr)) | 2209 while (*ptr != NUL && *ptr != '\n' && !vim_iswordc(*ptr)) |
2210 ++ptr; | 2210 ++ptr; |
2211 return ptr; | 2211 return ptr; |
2226 { | 2226 { |
2227 start_class = mb_get_class(ptr); | 2227 start_class = mb_get_class(ptr); |
2228 if (start_class > 1) | 2228 if (start_class > 1) |
2229 while (*ptr != NUL) | 2229 while (*ptr != NUL) |
2230 { | 2230 { |
2231 ptr += (*mb_ptr2len_check)(ptr); | 2231 ptr += (*mb_ptr2len)(ptr); |
2232 if (mb_get_class(ptr) != start_class) | 2232 if (mb_get_class(ptr) != start_class) |
2233 break; | 2233 break; |
2234 } | 2234 } |
2235 } | 2235 } |
2236 else | 2236 else |
3754 /* Copy remaining bytes of a multibyte character. */ | 3754 /* Copy remaining bytes of a multibyte character. */ |
3755 if (has_mbyte) | 3755 if (has_mbyte) |
3756 { | 3756 { |
3757 int i, mb_len; | 3757 int i, mb_len; |
3758 | 3758 |
3759 mb_len = (*mb_ptr2len_check)(src) - 1; | 3759 mb_len = (*mb_ptr2len)(src) - 1; |
3760 if (mb_len > 0 && len >= mb_len) | 3760 if (mb_len > 0 && len >= mb_len) |
3761 for (i = 0; i < mb_len; ++i) | 3761 for (i = 0; i < mb_len; ++i) |
3762 { | 3762 { |
3763 --len; | 3763 --len; |
3764 ++src; | 3764 ++src; |
4164 curwin->w_cursor.col = col; | 4164 curwin->w_cursor.col = col; |
4165 } | 4165 } |
4166 #ifdef FEAT_MBYTE | 4166 #ifdef FEAT_MBYTE |
4167 if (has_mbyte) | 4167 if (has_mbyte) |
4168 foundcol = curwin->w_cursor.col | 4168 foundcol = curwin->w_cursor.col |
4169 + (*mb_ptr2len_check)(ml_get_cursor()); | 4169 + (*mb_ptr2len)(ml_get_cursor()); |
4170 else | 4170 else |
4171 #endif | 4171 #endif |
4172 foundcol = curwin->w_cursor.col + 1; | 4172 foundcol = curwin->w_cursor.col + 1; |
4173 if (curwin->w_cursor.col < (colnr_T)wantcol) | 4173 if (curwin->w_cursor.col < (colnr_T)wantcol) |
4174 break; | 4174 break; |
5051 } | 5051 } |
5052 #endif | 5052 #endif |
5053 | 5053 |
5054 ptr = ml_get_cursor(); | 5054 ptr = ml_get_cursor(); |
5055 #ifdef FEAT_MBYTE | 5055 #ifdef FEAT_MBYTE |
5056 if (has_mbyte && (l = (*mb_ptr2len_check)(ptr)) > 1) | 5056 if (has_mbyte && (l = (*mb_ptr2len)(ptr)) > 1) |
5057 { | 5057 { |
5058 /* The character under the cursor is a multi-byte character, move | 5058 /* The character under the cursor is a multi-byte character, move |
5059 * several bytes right, but don't end up on the NUL. */ | 5059 * several bytes right, but don't end up on the NUL. */ |
5060 if (ptr[l] == NUL) | 5060 if (ptr[l] == NUL) |
5061 return FAIL; | 5061 return FAIL; |
5631 vcol = start_vcol; | 5631 vcol = start_vcol; |
5632 for (i = 0; i < ins_len; ++i) | 5632 for (i = 0; i < ins_len; ++i) |
5633 { | 5633 { |
5634 vcol += chartabsize(p + i, vcol); | 5634 vcol += chartabsize(p + i, vcol); |
5635 #ifdef FEAT_MBYTE | 5635 #ifdef FEAT_MBYTE |
5636 i += (*mb_ptr2len_check)(p) - 1; | 5636 i += (*mb_ptr2len)(p) - 1; |
5637 #endif | 5637 #endif |
5638 } | 5638 } |
5639 vcol -= start_vcol; | 5639 vcol -= start_vcol; |
5640 | 5640 |
5641 /* Delete spaces that were inserted after the cursor to keep the | 5641 /* Delete spaces that were inserted after the cursor to keep the |
7286 else | 7286 else |
7287 #endif | 7287 #endif |
7288 { | 7288 { |
7289 #ifdef FEAT_MBYTE | 7289 #ifdef FEAT_MBYTE |
7290 if (has_mbyte) | 7290 if (has_mbyte) |
7291 curwin->w_cursor.col += (*mb_ptr2len_check)(ml_get_cursor()); | 7291 curwin->w_cursor.col += (*mb_ptr2len)(ml_get_cursor()); |
7292 else | 7292 else |
7293 #endif | 7293 #endif |
7294 ++curwin->w_cursor.col; | 7294 ++curwin->w_cursor.col; |
7295 } | 7295 } |
7296 | 7296 |