diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-06 18:05:05 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-10 15:35:18 +0100 |
commit | b3a97c56b659f7b9bf1c021d654b3df0236171c7 (patch) | |
tree | 07f0efd7785496b905d2b9231354fedbd805f28e /src/nvim/buffer.c | |
parent | e8e2f73c3a4dfbbaa2cdd4a3e585fac6b4ba88b6 (diff) | |
download | rneovim-b3a97c56b659f7b9bf1c021d654b3df0236171c7.tar.gz rneovim-b3a97c56b659f7b9bf1c021d654b3df0236171c7.tar.bz2 rneovim-b3a97c56b659f7b9bf1c021d654b3df0236171c7.zip |
vim-patch:8.2.3384: cannot disable modeline for an individual file
Problem: Cannot disable modeline for an individual file.
Solution: Recognize "nomodeline" in a modeline. (Hu Jialun, closes vim/vim#8798)
https://github.com/vim/vim/commit/9dcd349ca85e1df1abd1cbf1c29c0f1574b70bf8
Cherry-pick missing modeline for test_modeline.vim (heh) from v8.2.1432.
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 81f8b9073e..55db72aa16 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -5261,15 +5261,16 @@ void do_modelines(int flags) } entered++; - for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count && lnum <= nmlines; - lnum++) { + for (lnum = 1; curbuf->b_p_ml && lnum <= curbuf->b_ml.ml_line_count + && lnum <= nmlines; lnum++) { if (chk_modeline(lnum, flags) == FAIL) { nmlines = 0; } } - for (lnum = curbuf->b_ml.ml_line_count; lnum > 0 && lnum > nmlines - && lnum > curbuf->b_ml.ml_line_count - nmlines; lnum--) { + for (lnum = curbuf->b_ml.ml_line_count; curbuf->b_p_ml && lnum > 0 + && lnum > nmlines && lnum > curbuf->b_ml.ml_line_count - nmlines; + lnum--) { if (chk_modeline(lnum, flags) == FAIL) { nmlines = 0; } |