Patch 8.2.0690
Problem: Line number of option set by modeline is wrong.
Solution: Do not double the line number. (Ozaki Kiichi, closes #6035)
Files: src/option.c, src/testdir/test_modeline.vim
*** ../vim-8.2.0689/src/option.c 2020-05-01 14:26:17.132949262 +0200
--- src/option.c 2020-05-03 17:19:07.577122635 +0200
***************
*** 2460,2466 ****
int indir = (int)options[opt_idx].indir;
sctx_T new_script_ctx = script_ctx;
! new_script_ctx.sc_lnum += SOURCING_LNUM;
// Remember where the option was set. For local options need to do that
// in the buffer or window structure.
--- 2460,2468 ----
int indir = (int)options[opt_idx].indir;
sctx_T new_script_ctx = script_ctx;
! // Modeline already has the line number set.
! if (!(opt_flags & OPT_MODELINE))
! new_script_ctx.sc_lnum += SOURCING_LNUM;
// Remember where the option was set. For local options need to do that
// in the buffer or window structure.
*** ../vim-8.2.0689/src/testdir/test_modeline.vim 2019-12-17
19:22:36.460117701 +0100
--- src/testdir/test_modeline.vim 2020-05-03 17:16:44.005754456 +0200
***************
*** 279,281 ****
--- 279,337 ----
call s:modeline_fails('tabline', 'tabline=Something()', 'E992:')
call s:modeline_fails('titlestring', 'titlestring=Something()', 'E992:')
endfunc
+
+ func Test_modeline_setoption_verbose()
+ let modeline = &modeline
+ set modeline
+
+ let lines =<< trim END
+ 1 vim:ts=2
+ 2 two
+ 3 three
+ 4 four
+ 5 five
+ 6 six
+ 7 seven
+ 8 eight
+ END
+ call writefile(lines, 'Xmodeline')
+ edit Xmodeline
+ let info = split(execute('verbose set tabstop?'), "\n")
+ call assert_match('^\s*Last set from modeline line 1$', info[-1])
+ bwipe!
+
+ let lines =<< trim END
+ 1 one
+ 2 two
+ 3 three
+ 4 vim:ts=4
+ 5 five
+ 6 six
+ 7 seven
+ 8 eight
+ END
+ call writefile(lines, 'Xmodeline')
+ edit Xmodeline
+ let info = split(execute('verbose set tabstop?'), "\n")
+ call assert_match('^\s*Last set from modeline line 4$', info[-1])
+ bwipe!
+
+ let lines =<< trim END
+ 1 one
+ 2 two
+ 3 three
+ 4 four
+ 5 five
+ 6 six
+ 7 seven
+ 8 vim:ts=8
+ END
+ call writefile(lines, 'Xmodeline')
+ edit Xmodeline
+ let info = split(execute('verbose set tabstop?'), "\n")
+ call assert_match('^\s*Last set from modeline line 8$', info[-1])
+ bwipe!
+
+ let &modeline = modeline
+ call delete('Xmodeline')
+ endfunc
*** ../vim-8.2.0689/src/version.c 2020-05-03 17:03:26.193589966 +0200
--- src/version.c 2020-05-03 17:17:47.017474083 +0200
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 690,
/**/
--
I started out with nothing, and I still have most of it.
-- Michael Davis -- "Tonight Show"
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202005031519.043FJxwU003269%40masaka.moolenaar.net.