]> granicus.if.org Git - vim/commitdiff
patch 8.0.0031 v8.0.0031
authorBram Moolenaar <Bram@vim.org>
Wed, 12 Oct 2016 15:45:29 +0000 (17:45 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 12 Oct 2016 15:45:29 +0000 (17:45 +0200)
Problem:    After ":bwipeout" 'fileformat' is not set to the right default.
Solution:   Get the default from 'fileformats'. (Mike Williams)

src/Makefile
src/option.c
src/testdir/test_alot.vim
src/testdir/test_fileformat.vim [new file with mode: 0644]
src/version.c

index ec984b7ad4fdddd320084a9d9f183889e59aa052..1589fbad72c184b25623604d680cff585a89fc42 100644 (file)
@@ -2081,6 +2081,7 @@ test_arglist \
        test_farsi \
        test_feedkeys \
        test_file_perm \
+       test_fileformat \
        test_filter_cmd \
        test_filter_map \
        test_fnameescape \
index ecac17550bbd25bbcefc5b5b4b487e5626556790..ebf443b84b8bbf406df6bb1f1c63fe5573359e0e 100644 (file)
@@ -10729,7 +10729,19 @@ buf_copy_options(buf_T *buf, int flags)
 #ifdef FEAT_MBYTE
                buf->b_p_fenc = vim_strsave(p_fenc);
 #endif
-               buf->b_p_ff = vim_strsave(p_ff);
+               switch (*p_ffs)
+               {
+                   case 'm':
+                       buf->b_p_ff = vim_strsave((char_u *)FF_MAC); break;
+                   case 'd':
+                       buf->b_p_ff = vim_strsave((char_u *)FF_DOS); break;
+                   case 'u':
+                       buf->b_p_ff = vim_strsave((char_u *)FF_UNIX); break;
+                   default:
+                       buf->b_p_ff = vim_strsave(p_ff);
+               }
+               if (buf->b_p_ff != NULL)
+                   buf->b_start_ffc = *buf->b_p_ff;
 #if defined(FEAT_QUICKFIX)
                buf->b_p_bh = empty_option;
                buf->b_p_bt = empty_option;
index e57439112c6969229f9845d7bbc956a4df0014c2..d24b97fb92f5908fee113f8f5aada9e5fb9694b8 100644 (file)
@@ -12,10 +12,11 @@ source test_expand.vim
 source test_expr.vim
 source test_expand_dllpath.vim
 source test_feedkeys.vim
-source test_fnamemodify.vim
 source test_file_perm.vim
+source test_fileformat.vim
 source test_filter_cmd.vim
 source test_filter_map.vim
+source test_fnamemodify.vim
 source test_glob2regpat.vim
 source test_goto.vim
 source test_help_tagjump.vim
diff --git a/src/testdir/test_fileformat.vim b/src/testdir/test_fileformat.vim
new file mode 100644 (file)
index 0000000..584f20c
--- /dev/null
@@ -0,0 +1,17 @@
+" Test behavior of fileformat after bwipeout of last buffer
+
+func Test_fileformat_after_bw()
+  bwipeout
+  set fileformat&
+  if &fileformat == 'dos'
+    let test_fileformats = 'unix'
+  elseif &fileformat == 'unix'
+    let test_fileformats = 'mac'
+  else  " must be mac
+    let test_fileformats = 'dos'
+  endif
+  exec 'set fileformats='.test_fileformats
+  bwipeout!
+  call assert_equal(test_fileformats, &fileformat)
+  set fileformats&
+endfunc
index 07b3da794f71f82542a89e6c0335045e450d5b1a..39662f63e9569225ddf9181f81aff0ab23cda20a 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    31,
 /**/
     30,
 /**/