File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,12 @@ impl Default for LayoutOptions {
124
124
}
125
125
}
126
126
127
- fn layout ( text : & str , scale_factor : ScaleFactor , options : LayoutOptions ) -> Layout {
127
+ fn layout ( text : & str , scale_factor : ScaleFactor , mut options : LayoutOptions ) -> Layout {
128
+ // When a piece of text is first selected, it gets an empty range like `Some(1..1)`.
129
+ // If the text starts with a multi-byte character then this selection will be within
130
+ // that character and parley will panic. We just filter out empty selection ranges.
131
+ options. selection = options. selection . filter ( |selection| !selection. is_empty ( ) ) ;
132
+
128
133
let max_physical_width = options. max_width . map ( |max_width| max_width * scale_factor) ;
129
134
let max_physical_height = options. max_height . map ( |max_height| max_height * scale_factor) ;
130
135
let pixel_size = options
You can’t perform that action at this time.
0 commit comments