]> granicus.if.org Git - vim/commitdiff
patch 8.1.1768: man plugin changes setting in current window v8.1.1768
authorBram Moolenaar <Bram@vim.org>
Sun, 28 Jul 2019 13:28:45 +0000 (15:28 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 28 Jul 2019 13:28:45 +0000 (15:28 +0200)
Problem:    Man plugin changes setting in current window.
Solution:   Set options later. (Jason Franklin)

runtime/ftplugin/man.vim
src/testdir/test_man.vim
src/version.c

index fb3f7f90a1a3455112c2df339d217b19f3e22cb9..4591c478d99b0603f669508f183763c02c8da7ab 100644 (file)
@@ -174,7 +174,6 @@ func <SID>GetPage(cmdmods, ...)
       else
        let open_cmd = a:cmdmods . ' split'
       endif
-      setl nonu fdc=0
     endif
   endif
 
@@ -183,7 +182,7 @@ func <SID>GetPage(cmdmods, ...)
   " Avoid warning for editing the dummy file twice
   setl buftype=nofile noswapfile
 
-  setl ma nonu nornu nofen
+  setl fdc=0 ma nofen nonu nornu
   silent exec "norm! 1GdG"
   let unsetwidth = 0
   if empty($MANWIDTH)
index b1cb982a17534378538e6a6ebfa2395e78f9accf..9de8cb474aaded6f1e8eef7ce6493d9773d6dc3a 100644 (file)
@@ -1,6 +1,6 @@
 runtime ftplugin/man.vim
 
-function Test_g_ft_man_open_mode()
+func Test_g_ft_man_open_mode()
   vnew
   let l:h = winheight(1)
   q
@@ -48,9 +48,9 @@ function Test_g_ft_man_open_mode()
   q
 
   unlet g:ft_man_open_mode
-endfunction
+endfunc
 
-function Test_nomodifiable()
+func Test_nomodifiable()
   let wincnt = winnr('$')
   Man vim
   if wincnt == winnr('$')
@@ -59,9 +59,9 @@ function Test_nomodifiable()
   endif
   call assert_false(&l:modifiable)
   q
-endfunction
+endfunc
 
-function Test_buffer_count_hidden()
+func Test_buffer_count_hidden()
   %bw!
   set hidden
 
@@ -85,4 +85,29 @@ function Test_buffer_count_hidden()
   q
 
   set hidden&
-endfunction
+endfunc
+
+" Check that we do not alter the settings in the initial window.
+func Test_local_options()
+  %bw!
+  set foldcolumn=1 number
+
+  let wincnt = winnr('$')
+  Man vim
+  if wincnt == winnr('$')
+    " Vim manual page cannot be found.
+    return
+  endif
+
+  " man page
+  call assert_false(&nu)
+  call assert_equal(0, &fdc)
+
+  " initial window
+  wincmd p
+  call assert_true(&nu)
+  call assert_equal(1, &fdc)
+
+  %bw!
+  set foldcolumn& number&
+endfunc
index 496a2eea93306020d92922a8ab38f02b5485329e..166b17c96e8361b574ab415205c620cfde22db56 100644 (file)
@@ -777,6 +777,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1768,
 /**/
     1767,
 /**/