Skip to content

Commit e8ef3a0

Browse files
committed
patch 8.0.0031
Problem: After ":bwipeout" 'fileformat' is not set to the right default. Solution: Get the default from 'fileformats'. (Mike Williams)
1 parent 0ba4070 commit e8ef3a0

File tree

5 files changed

+35
-2
lines changed

5 files changed

+35
-2
lines changed

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,6 +2081,7 @@ test_arglist \
20812081
test_farsi \
20822082
test_feedkeys \
20832083
test_file_perm \
2084+
test_fileformat \
20842085
test_filter_cmd \
20852086
test_filter_map \
20862087
test_fnameescape \

src/option.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10729,7 +10729,19 @@ buf_copy_options(buf_T *buf, int flags)
1072910729
#ifdef FEAT_MBYTE
1073010730
buf->b_p_fenc = vim_strsave(p_fenc);
1073110731
#endif
10732-
buf->b_p_ff = vim_strsave(p_ff);
10732+
switch (*p_ffs)
10733+
{
10734+
case 'm':
10735+
buf->b_p_ff = vim_strsave((char_u *)FF_MAC); break;
10736+
case 'd':
10737+
buf->b_p_ff = vim_strsave((char_u *)FF_DOS); break;
10738+
case 'u':
10739+
buf->b_p_ff = vim_strsave((char_u *)FF_UNIX); break;
10740+
default:
10741+
buf->b_p_ff = vim_strsave(p_ff);
10742+
}
10743+
if (buf->b_p_ff != NULL)
10744+
buf->b_start_ffc = *buf->b_p_ff;
1073310745
#if defined(FEAT_QUICKFIX)
1073410746
buf->b_p_bh = empty_option;
1073510747
buf->b_p_bt = empty_option;

src/testdir/test_alot.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ source test_expand.vim
1212
source test_expr.vim
1313
source test_expand_dllpath.vim
1414
source test_feedkeys.vim
15-
source test_fnamemodify.vim
1615
source test_file_perm.vim
16+
source test_fileformat.vim
1717
source test_filter_cmd.vim
1818
source test_filter_map.vim
19+
source test_fnamemodify.vim
1920
source test_glob2regpat.vim
2021
source test_goto.vim
2122
source test_help_tagjump.vim

src/testdir/test_fileformat.vim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
" Test behavior of fileformat after bwipeout of last buffer
2+
3+
func Test_fileformat_after_bw()
4+
bwipeout
5+
set fileformat&
6+
if &fileformat == 'dos'
7+
let test_fileformats = 'unix'
8+
elseif &fileformat == 'unix'
9+
let test_fileformats = 'mac'
10+
else " must be mac
11+
let test_fileformats = 'dos'
12+
endif
13+
exec 'set fileformats='.test_fileformats
14+
bwipeout!
15+
call assert_equal(test_fileformats, &fileformat)
16+
set fileformats&
17+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
31,
767769
/**/
768770
30,
769771
/**/

0 commit comments

Comments
 (0)