patch 9.0.0862: default value of 'endoffile' is wrong v9.0.0862
authorBram Moolenaar <Bram@vim.org>
Sat, 12 Nov 2022 11:54:26 +0000 (11:54 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 12 Nov 2022 11:54:26 +0000 (11:54 +0000)
Problem:    Default value of 'endoffile' is wrong.
Solution:   The default must be 'noendoffile'.

runtime/doc/options.txt
src/optiondefs.h
src/testdir/test_options.vim
src/version.c

index bdc473df3e9a0aee56e04cc7cf90f4fb3d3c486a..4642bdd481263aa6e894c9e1d5eb5befd902d357 100644 (file)
@@ -3049,7 +3049,7 @@ A jump table for the options with a short description can be found at |Q_op|.
        not set yet, the default for 'fileencodings' is changed.
 
                        *'endoffile'* *'eof'* *'noendoffile'* *'noeof'*
-'endoffile' 'eof'      boolean (default on)
+'endoffile' 'eof'      boolean (default off)
                        local to buffer
        Indicates that a CTRL-Z character was found at the end of the file
        when reading it.  Normally only happens when 'fileformat' is "dos".
index 43a334fc073159258b881416e7026b5a50c44a6b..5b3860b613bf5b6a6326be38e015d42eb9b223cf 100644 (file)
@@ -857,7 +857,7 @@ static struct vimoption options[] =
                            SCTX_INIT},
     {"endoffile",   "eof",  P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
                            (char_u *)&p_eof, PV_EOF,
-                           {(char_u *)TRUE, (char_u *)0L} SCTX_INIT},
+                           {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
     {"endofline",   "eol",  P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
                            (char_u *)&p_eol, PV_EOL,
                            {(char_u *)TRUE, (char_u *)0L} SCTX_INIT},
index 23c4077a91daddba5fb1c779e8fce17d753e1ee4..30828e2da843363d17788f43b567a6c9e2e75dd6 100644 (file)
@@ -1453,5 +1453,17 @@ func Test_keywordprg_empty()
   let &keywordprg = k
 endfunc
 
+" check that the very first buffer created does not have 'endoffile' set
+func Test_endoffile_default()
+  let after =<< trim [CODE]
+    call writefile([execute('set eof?')], 'Xtestout')
+    qall!
+  [CODE]
+  if RunVim([], after, '')
+    call assert_equal(["\nnoendoffile"], readfile('Xtestout'))
+  endif
+  call delete('Xtestout')
+endfunc
+
 
 " vim: shiftwidth=2 sts=2 expandtab
index dd6927301c4c95c004926f553492d302e5c3bc23..8e970257b6adfaa36cd9f78601610c4e45916afe 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    862,
 /**/
     861,
 /**/