diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-03-30 21:41:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-30 13:41:05 +0000 |
commit | 431c037709d1e0e44a97b9eaa51afdc8354b492c (patch) | |
tree | 5d5a52f43a9215b51c12954d81a271b466d5e0c4 /src | |
parent | 75fe54050081d8338a01b8cf72da424f022d0d83 (diff) | |
download | rneovim-431c037709d1e0e44a97b9eaa51afdc8354b492c.tar.gz rneovim-431c037709d1e0e44a97b9eaa51afdc8354b492c.tar.bz2 rneovim-431c037709d1e0e44a97b9eaa51afdc8354b492c.zip |
vim-patch:9.1.1260: Hang when filtering buffer with NUL bytes (#33192)
Problem: Hang when filtering buffer with NUL bytes (after 9.1.1050).
Solution: Don't subtract "written" from "lplen" repeatedly (zeertzjq).
related: neovim/neovim#33173
closes: vim/vim#17011
https://github.com/vim/vim/commit/53fed23cb7bd59d9400961b44c6c8dca0029c929
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/os/shell.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index d60d0b3e55..e711611d67 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -1211,7 +1211,6 @@ static void read_input(StringBuilder *buf) size_t lplen = (size_t)ml_get_len(lnum); while (true) { - lplen -= written; if (lplen == 0) { len = 0; } else if (lp[written] == NL) { @@ -1220,11 +1219,11 @@ static void read_input(StringBuilder *buf) kv_push(*buf, NUL); } else { char *s = vim_strchr(lp + written, NL); - len = s == NULL ? lplen : (size_t)(s - (lp + written)); + len = s == NULL ? lplen - written : (size_t)(s - (lp + written)); kv_concat_len(*buf, lp + written, len); } - if (len == lplen) { + if (len == lplen - written) { // Finished a line, add a NL, unless this line should not have one. if (lnum != curbuf->b_op_end.lnum || (!curbuf->b_p_bin && curbuf->b_p_fixeol) |