@@ -1507,15 +1507,12 @@ impl<U: EventListener> Crosswords<U> {
15071507 ..
15081508 } ) => {
15091509 for line in ( start. row . 0 ..end. row . 0 ) . map ( Line :: from) {
1510- res += self
1511- . line_to_string ( line, start. col ..end. col , start. col . 0 != 0 )
1512- . trim_end ( ) ;
1510+ res +=
1511+ & self . line_to_string ( line, start. col ..end. col , start. col . 0 != 0 ) ;
15131512 res += "\n " ;
15141513 }
15151514
1516- res += self
1517- . line_to_string ( end. row , start. col ..end. col , true )
1518- . trim_end ( ) ;
1515+ res += & self . line_to_string ( end. row , start. col ..end. col , true ) ;
15191516 }
15201517 Some ( Selection {
15211518 ty : SelectionType :: Lines ,
@@ -1587,7 +1584,8 @@ impl<U: EventListener> Crosswords<U> {
15871584 }
15881585
15891586 /// Convert a single line in the grid to a String. Used by Block selection;
1590- /// trailing blank cells are dropped.
1587+ /// trailing blank cells are dropped. No trailing newline is appended —
1588+ /// the caller controls row separation.
15911589 fn line_to_string (
15921590 & self ,
15931591 line : Line ,
@@ -1596,25 +1594,13 @@ impl<U: EventListener> Crosswords<U> {
15961594 ) -> String {
15971595 let mut text = String :: new ( ) ;
15981596 let mut blank_cells = 0 ;
1599-
1600- let line_length = std:: cmp:: min ( self . grid [ line] . line_length ( ) , cols. end + 1 ) ;
1601- let cols_end = cols. end ;
1602-
16031597 self . append_cells (
16041598 & mut text,
16051599 line,
16061600 cols,
16071601 include_wrapped_wide,
16081602 & mut blank_cells,
16091603 ) ;
1610- // Trailing blank_cells intentionally dropped.
1611-
1612- if cols_end >= self . grid . columns ( ) - 1
1613- && ( line_length. 0 == 0 || !self . grid [ line] [ line_length - 1 ] . wrapline ( ) )
1614- {
1615- text. push ( '\n' ) ;
1616- }
1617-
16181604 text
16191605 }
16201606
0 commit comments