diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-12-28 22:39:57 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-12-28 22:39:57 +0000 |
commit | ebefac63f30ac038c0c35d7f1b9257483ec41812 (patch) | |
tree | 63e6374375ebc6744379fba43c1c557187490143 /src/getchar.c | |
parent | cc984263d755d05a12c8391abff42c087237554e (diff) | |
download | vim-git-ebefac63f30ac038c0c35d7f1b9257483ec41812.tar.gz |
updated for version 7.0177v7.0177
Diffstat (limited to 'src/getchar.c')
-rw-r--r-- | src/getchar.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/getchar.c b/src/getchar.c index 69cebaee5..c1c9bca75 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -529,16 +529,18 @@ AppendToRedobuff(s) * K_SPECIAL and CSI are escaped as well. */ void -AppendToRedobuffLit(s) - char_u *s; +AppendToRedobuffLit(str, len) + char_u *str; + int len; /* length of "str" or -1 for up to the NUL */ { + char_u *s = str; int c; char_u *start; if (block_redo) return; - while (*s != NUL) + while (len < 0 ? *s != NUL : s - str < len) { /* Put a string of normal characters in the redo buffer (that's * faster). */ @@ -547,7 +549,7 @@ AppendToRedobuffLit(s) #ifndef EBCDIC && *s < DEL /* EBCDIC: all chars above space are normal */ #endif - ) + && (len < 0 || s - str < len)) ++s; /* Don't put '0' or '^' as last character, just in case a CTRL-D is @@ -557,29 +559,29 @@ AppendToRedobuffLit(s) if (s > start) add_buff(&redobuff, start, (long)(s - start)); - if (*s != NUL) - { - /* Handle a special or multibyte character. */ + if (*s == NUL || (len >= 0 && s - str >= len)) + break; + + /* Handle a special or multibyte character. */ #ifdef FEAT_MBYTE - if (has_mbyte) - /* Handle composing chars separately. */ - c = mb_cptr2char_adv(&s); - else + if (has_mbyte) + /* Handle composing chars separately. */ + c = mb_cptr2char_adv(&s); + else #endif - c = *s++; - if (c < ' ' || c == DEL || (*s == NUL && (c == '0' || c == '^'))) - add_char_buff(&redobuff, Ctrl_V); + c = *s++; + if (c < ' ' || c == DEL || (*s == NUL && (c == '0' || c == '^'))) + add_char_buff(&redobuff, Ctrl_V); - /* CTRL-V '0' must be inserted as CTRL-V 048 (EBCDIC: xf0) */ - if (*s == NUL && c == '0') + /* CTRL-V '0' must be inserted as CTRL-V 048 (EBCDIC: xf0) */ + if (*s == NUL && c == '0') #ifdef EBCDIC - add_buff(&redobuff, (char_u *)"xf0", 3L); + add_buff(&redobuff, (char_u *)"xf0", 3L); #else - add_buff(&redobuff, (char_u *)"048", 3L); + add_buff(&redobuff, (char_u *)"048", 3L); #endif - else - add_char_buff(&redobuff, c); - } + else + add_char_buff(&redobuff, c); } } |