Mercurial > vim
comparison src/misc1.c @ 1470:48b22e2eb1ed v7.1.185
updated for version 7.1-185
author | vimboss |
---|---|
date | Wed, 02 Jan 2008 16:49:36 +0000 |
parents | db8309865794 |
children | 276244befa5b |
comparison
equal
deleted
inserted
replaced
1469:88c0c6c9eada | 1470:48b22e2eb1ed |
---|---|
589 */ | 589 */ |
590 replace_push(NUL); /* Call twice because BS over NL expects it */ | 590 replace_push(NUL); /* Call twice because BS over NL expects it */ |
591 replace_push(NUL); | 591 replace_push(NUL); |
592 p = saved_line + curwin->w_cursor.col; | 592 p = saved_line + curwin->w_cursor.col; |
593 while (*p != NUL) | 593 while (*p != NUL) |
594 replace_push(*p++); | 594 { |
595 #ifdef FEAT_MBYTE | |
596 if (has_mbyte) | |
597 p += replace_push_mb(p); | |
598 else | |
599 #endif | |
600 replace_push(*p++); | |
601 } | |
595 saved_line[curwin->w_cursor.col] = NUL; | 602 saved_line[curwin->w_cursor.col] = NUL; |
596 } | 603 } |
597 #endif | 604 #endif |
598 | 605 |
599 if ((State & INSERT) | 606 if ((State & INSERT) |
1912 ins_char_bytes(buf, charlen) | 1919 ins_char_bytes(buf, charlen) |
1913 char_u *buf; | 1920 char_u *buf; |
1914 int charlen; | 1921 int charlen; |
1915 { | 1922 { |
1916 int c = buf[0]; | 1923 int c = buf[0]; |
1917 int l, j; | |
1918 #endif | 1924 #endif |
1919 int newlen; /* nr of bytes inserted */ | 1925 int newlen; /* nr of bytes inserted */ |
1920 int oldlen; /* nr of bytes deleted (0 when not replacing) */ | 1926 int oldlen; /* nr of bytes deleted (0 when not replacing) */ |
1921 char_u *p; | 1927 char_u *p; |
1922 char_u *newp; | 1928 char_u *newp; |
2014 * first (it tells the byte length of the character). */ | 2020 * first (it tells the byte length of the character). */ |
2015 replace_push(NUL); | 2021 replace_push(NUL); |
2016 for (i = 0; i < oldlen; ++i) | 2022 for (i = 0; i < oldlen; ++i) |
2017 { | 2023 { |
2018 #ifdef FEAT_MBYTE | 2024 #ifdef FEAT_MBYTE |
2019 l = (*mb_ptr2len)(oldp + col + i) - 1; | 2025 if (has_mbyte) |
2020 for (j = l; j >= 0; --j) | 2026 i += replace_push_mb(oldp + col + i) - 1; |
2021 replace_push(oldp[col + i + j]); | 2027 else |
2022 i += l; | 2028 #endif |
2023 #else | 2029 replace_push(oldp[col + i]); |
2024 replace_push(oldp[col + i]); | |
2025 #endif | |
2026 } | 2030 } |
2027 } | 2031 } |
2028 | 2032 |
2029 newp = alloc_check((unsigned)(linelen + newlen - oldlen)); | 2033 newp = alloc_check((unsigned)(linelen + newlen - oldlen)); |
2030 if (newp == NULL) | 2034 if (newp == NULL) |