File tree Expand file tree Collapse file tree 3 files changed +35
-3
lines changed
Expand file tree Collapse file tree 3 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -5318,7 +5318,9 @@ get_bad_opt(char_u *p, exarg_T *eap)
53185318 eap -> bad_char = BAD_DROP ;
53195319 else if (MB_BYTE2LEN (* p ) == 1 && p [1 ] == NUL )
53205320 eap -> bad_char = * p ;
5321- return FAIL ;
5321+ else
5322+ return FAIL ;
5323+ return OK ;
53225324}
53235325#endif
53245326
Original file line number Diff line number Diff line change 11" Tests for complicated + argument to :edit command
22function Test_edit ()
3- call writefile ([" foo|bar" ], " Xfile1" )
4- call writefile ([" foo/bar" ], " Xfile2" )
3+ call writefile ([" foo|bar" ], " Xfile1" )
4+ call writefile ([" foo/bar" ], " Xfile2" )
55 edit + 1 |s /|/ PIPE/|w Xfile1| e Xfile2|1 | s/ \/ /SLASH/ |w
66 call assert_equal ([" fooPIPEbar" ], readfile (" Xfile1" ))
77 call assert_equal ([" fooSLASHbar" ], readfile (" Xfile2" ))
88 call delete (' Xfile1' )
99 call delete (' Xfile2' )
1010endfunction
11+
12+ func Test_edit_bad ()
13+ if ! has (' multi_byte' )
14+ finish
15+ endif
16+
17+ " Test loading a utf8 file with bad utf8 sequences.
18+ call writefile ([" [\xff ][\xc0 ][\xe2\x89\xf0 ][\xc2\xc2 ]" ], " Xfile" )
19+ new
20+
21+ " Without ++bad=..., the default behavior is like ++bad=?
22+ e ! ++ enc = utf8 Xfile
23+ call assert_equal (' [?][?][???][??]' , getline (1 ))
24+
25+ e ! ++ enc = utf8 ++ bad = _ Xfile
26+ call assert_equal (' [_][_][___][__]' , getline (1 ))
27+
28+ e ! ++ enc = utf8 ++ bad = drop Xfile
29+ call assert_equal (' [][][][]' , getline (1 ))
30+
31+ e ! ++ enc = utf8 ++ bad = keep Xfile
32+ call assert_equal (" [\xff ][\xc0 ][\xe2\x89\xf0 ][\xc2\xc2 ]" , getline (1 ))
33+
34+ call assert_fails (' e! ++enc=utf8 ++bad=foo Xfile' , ' E474:' )
35+
36+ bw !
37+ call delete (' Xfile' )
38+ endfunc
Original file line number Diff line number Diff line change @@ -761,6 +761,8 @@ static char *(features[]) =
761761
762762static int included_patches [] =
763763{ /* Add new patch number below this line */
764+ /**/
765+ 43 ,
764766/**/
765767 42 ,
766768/**/
You can’t perform that action at this time.
0 commit comments