File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -249,10 +249,10 @@ fn quoted_string_char(input: &str) -> nom::IResult<&str, char> {
249249 alt ( ( none_of ( "\\ \" " ) , escaped_char) ) ( input)
250250}
251251
252- // meant for \" mostly for now
252+ // meant for \" and \\ mostly for now
253253fn escaped_char ( input : & str ) -> nom:: IResult < & str , char > {
254254 let ( input, _) = char ( '\\' ) ( input) ?;
255- none_of ( " \\ " ) ( input)
255+ anychar ( input)
256256}
257257
258258fn parse_word ( input : & str ) -> nom:: IResult < & str , String > {
@@ -279,6 +279,14 @@ mod tests {
279279 ) ;
280280 }
281281
282+ #[ test]
283+ fn parse_quoted_string_quoted_backslash ( ) {
284+ assert_eq ! (
285+ "my \" str\\ ing" ,
286+ parse_quoted_string( "\" my \\ \" str\\ \\ ing\" " ) . unwrap( ) . 1
287+ ) ;
288+ }
289+
282290 #[ test]
283291 fn should_reject_unknown_filter_key ( ) {
284292 assert_eq ! (
Original file line number Diff line number Diff line change @@ -291,7 +291,7 @@ impl Widget for HeaderbarSearch {
291291 }
292292 if val. contains ( ' ' ) || val. contains ( '"' ) {
293293 t. push ( '"' ) ;
294- t. push_str ( & val. replace ( '"' , "\\ \" " ) ) ;
294+ t. push_str ( & val. replace ( '\\' , " \\ \\ " ) . replace ( ' "', "\\ \" " ) ) ;
295295 t. push ( '"' ) ;
296296 } else {
297297 t. push_str ( & val) ;
You can’t perform that action at this time.
0 commit comments