aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-09-30 23:03:48 -0400
committerJustin M. Keyes <justinkz@gmail.com>2014-09-30 23:03:48 -0400
commit8a14268ab97e0245a014282c8bb1ccfdf17d014e (patch)
treefc40abc08e13259a729b220518fe51958e2fd5dd /src/nvim/ops.c
parentafe7ba1e71f0fe43817ae9abac56c721c99f95c6 (diff)
parent01fc01e5d6d170715c5f00dab767f857ecec7c21 (diff)
downloadrneovim-8a14268ab97e0245a014282c8bb1ccfdf17d014e.tar.gz
rneovim-8a14268ab97e0245a014282c8bb1ccfdf17d014e.tar.bz2
rneovim-8a14268ab97e0245a014282c8bb1ccfdf17d014e.zip
Merge pull request #1141 from splinterofchaos/system-nl
vim-patch:7.4.247 + vim-patch:7.4.248 + vim-patch:7.4.256 + f_system() bug fix
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 9b98c84be4..2067d863eb 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -4903,10 +4903,9 @@ static void str_to_reg(struct yankreg *y_ptr,
* Find the end of each line and save it into the array.
*/
for (start = 0; start < len + extraline; start += i + 1) {
- for (i = start; i < len; ++i) /* find the end of the line */
- if (str[i] == '\n')
- break;
- i -= start; /* i is now length of line */
+ // Let i represent the length of one line.
+ const char_u *p = str + start;
+ i = (char_u *)xmemscan(p, '\n', len - start) - p;
if (i > maxlen)
maxlen = i;
if (append) {