Commit c2ab040 1 parent cf0338d commit c2ab040 Copy full SHA for c2ab040
File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ fn line_break(
249
249
}
250
250
251
251
if row_start_idx < paragraph. glyphs . len ( ) {
252
- if non_empty_rows == job. wrap . max_rows {
252
+ if job . wrap . max_rows > 0 && non_empty_rows == job. wrap . max_rows {
253
253
if let Some ( last_row) = out_rows. last_mut ( ) {
254
254
replace_last_glyph_with_overflow_character ( fonts, job, last_row) ;
255
255
}
@@ -773,3 +773,14 @@ fn is_chinese(c: char) -> bool {
773
773
|| ( '\u{3400}' <= c && c <= '\u{4DBF}' )
774
774
|| ( '\u{2B740}' <= c && c <= '\u{2B81F}' )
775
775
}
776
+
777
+ // ----------------------------------------------------------------------------
778
+
779
+ #[ test]
780
+ fn test_zero_max_width ( ) {
781
+ let mut fonts = FontsImpl :: new ( 1.0 , 1024 , super :: FontDefinitions :: default ( ) ) ;
782
+ let mut layout_job = LayoutJob :: single_section ( "W" . into ( ) , super :: TextFormat :: default ( ) ) ;
783
+ layout_job. wrap . max_width = 0.0 ;
784
+ let galley = super :: layout ( & mut fonts, layout_job. into ( ) ) ;
785
+ assert_eq ! ( galley. rows. len( ) , 1 ) ;
786
+ }
You can’t perform that action at this time.
0 commit comments