File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change 11use std:: path:: MAIN_SEPARATOR_STR ;
22
33use cosmic_text:: { Attrs , Family , Metrics } ;
4- use regex:: Regex ;
4+ use regex:: { escape , Regex } ;
55
66use crate :: {
77 edges:: margin:: Margin ,
@@ -42,15 +42,13 @@ impl Component for Breadcrumbs {
4242
4343 self . path
4444 . as_ref ( )
45- . and_then ( |path| {
46- let ( w, h) = calc_wh_with_min_width ( & path, 8. , LINE_HEIGHT ) ;
47-
48- return Some (
49- style
50- . clone ( )
51- . size ( Size :: Num ( w) , Size :: Num ( h) )
52- . margin ( Margin :: default ( ) ) ,
53- ) ;
45+ . map ( |path| {
46+ let ( w, h) = calc_wh_with_min_width ( path, 8. , LINE_HEIGHT ) ;
47+
48+ style
49+ . clone ( )
50+ . size ( Size :: Num ( w) , Size :: Num ( h) )
51+ . margin ( Margin :: default ( ) )
5452 } )
5553 . unwrap_or ( style)
5654 }
@@ -103,7 +101,7 @@ impl Breadcrumbs {
103101}
104102
105103fn parse_separator ( path_str : & str , separator : & str ) -> String {
106- Regex :: new ( MAIN_SEPARATOR_STR )
104+ Regex :: new ( & escape ( MAIN_SEPARATOR_STR ) )
107105 . unwrap ( )
108106 . replace_all ( path_str, separator)
109107 . to_string ( )
You can’t perform that action at this time.
0 commit comments