summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-10-12 17:45:29 +0200
committerBram Moolenaar <Bram@vim.org>2016-10-12 17:45:29 +0200
commite8ef3a093453b73594e15462d4de50b011c8ba66 (patch)
treeb0954c301736bd9c972f37f8efc49f63a64e6bdb
parent0ba407012c63064f03f1a5677677d4da423e5a73 (diff)
patch 8.0.0031v8.0.0031
Problem: After ":bwipeout" 'fileformat' is not set to the right default. Solution: Get the default from 'fileformats'. (Mike Williams)
-rw-r--r--src/Makefile1
-rw-r--r--src/option.c14
-rw-r--r--src/testdir/test_alot.vim3
-rw-r--r--src/testdir/test_fileformat.vim17
-rw-r--r--src/version.c2
5 files changed, 35 insertions, 2 deletions
diff --git a/src/Makefile b/src/Makefile
index ec984b7ad4..1589fbad72 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2081,6 +2081,7 @@ test_arglist \
test_farsi \
test_feedkeys \
test_file_perm \
+ test_fileformat \
test_filter_cmd \
test_filter_map \
test_fnameescape \
diff --git a/src/option.c b/src/option.c
index ecac17550b..ebf443b84b 100644
--- a/src/option.c
+++ b/src/option.c
@@ -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;
diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim
index e57439112c..d24b97fb92 100644
--- a/src/testdir/test_alot.vim
+++ b/src/testdir/test_alot.vim
@@ -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
index 0000000000..584f20cdfc
--- /dev/null
+++ b/src/testdir/test_fileformat.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index 07b3da794f..39662f63e9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 31,
+/**/
30,
/**/
29,