Mercurial > vim
diff src/if_perl.xs @ 10759:4267f8904d47 v8.0.0269
patch 8.0.0269: may get ml_get error when :perldo deletes lines
commit https://github.com/vim/vim/commit/85b5743d3e69f96882b6124d4b4ebf873ca24707
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 29 22:59:12 2017 +0100
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Problem: May get ml_get error when :perldo deletes lines or switches to
another buffer. (Nikolai Pavlov, issue https://github.com/vim/vim/issues/1421)
Solution: Check the buffer and line every time.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 29 Jan 2017 23:00:05 +0100 |
parents | 4aead6a9b7a9 |
children | 778c10516955 |
line wrap: on
line diff
--- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -1286,6 +1286,7 @@ ex_perldo(exarg_T *eap) SV *sv; char *str; linenr_T i; + buf_T *was_curbuf = curbuf; if (bufempty()) return; @@ -1321,11 +1322,14 @@ ex_perldo(exarg_T *eap) SAVETMPS; for (i = eap->line1; i <= eap->line2; i++) { + /* Check the line number, the command my have deleted lines. */ + if (i > curbuf->b_ml.ml_line_count) + break; sv_setpv(GvSV(PL_defgv), (char *)ml_get(i)); PUSHMARK(sp); perl_call_pv("VIM::perldo", G_SCALAR | G_EVAL); str = SvPV(GvSV(PL_errgv), length); - if (length) + if (length || curbuf != was_curbuf) break; SPAGAIN; if (SvTRUEx(POPs))