@@ -3939,6 +3939,24 @@ testSubstitute('ex_substitute_forward_slash_regex', {
39393939 expectedValue : 'forward slash was here' ,
39403940 expr : '%s#\\/##g' ,
39413941 noPcreExpr : '%s#/##g' } ) ;
3942+ testVim ( "ex_substitute_ampersand_pcre" , function ( cm , vim , helpers ) {
3943+ cm . setCursor ( 0 , 0 ) ;
3944+ CodeMirror . Vim . setOption ( 'pcre' , true ) ;
3945+ helpers . doEx ( '%s/foo/namespace.&/' ) ;
3946+ eq ( "namespace.foo" , cm . getValue ( ) ) ;
3947+ } , { value : 'foo' } ) ;
3948+ testVim ( "ex_substitute_ampersand_multiple_pcre" , function ( cm , vim , helpers ) {
3949+ cm . setCursor ( 0 , 0 ) ;
3950+ CodeMirror . Vim . setOption ( 'pcre' , true ) ;
3951+ helpers . doEx ( '%s/f.o/namespace.&/' ) ;
3952+ eq ( "namespace.foo\nnamespace.fzo" , cm . getValue ( ) ) ;
3953+ } , { value : 'foo\nfzo' } ) ;
3954+ testVim ( "ex_escaped_ampersand_should_not_substitute_pcre" , function ( cm , vim , helpers ) {
3955+ cm . setCursor ( 0 , 0 ) ;
3956+ CodeMirror . Vim . setOption ( 'pcre' , true ) ;
3957+ helpers . doEx ( '%s/foo/namespace.\\&/' ) ;
3958+ eq ( "namespace.&" , cm . getValue ( ) ) ;
3959+ } , { value : 'foo' } ) ;
39423960testSubstitute ( 'ex_substitute_backslashslash_regex' , {
39433961 value : 'one\\two \n three\\four' ,
39443962 expectedValue : 'one,two \n three,four' ,
0 commit comments