@@ -218,12 +218,17 @@ impl<'a> DisplayList<'a> {
218218} else {
219219false
220220} ;
221+ // Specifies that it will end on the next character, so it will return
222+ // until the next one to the final condition.
221223let mut ended =false ;
222224let range = text
223225. char_indices ( )
224- . chain ( once ( ( text. len ( ) , '\0' ) ) )
225226. skip ( left)
227+ // Complete char iterator with final character
228+ . chain ( once ( ( text. len ( ) , '\0' ) ) )
229+ // Take until the next one to the final condition
226230. take_while ( |( _, ch) |{
231+ // Fast return to iterate over final byte position
227232if ended{
228233return false ;
229234}
@@ -236,6 +241,7 @@ impl<'a> DisplayList<'a> {
236241}
237242true
238243} )
244+ // Reduce to start and end byte position
239245. fold ( ( None , 0 ) , |acc, ( i, _) |{
240246if acc. 0 . is_some ( ) {
241247( acc. 0 , i)
@@ -244,6 +250,7 @@ impl<'a> DisplayList<'a> {
244250}
245251} ) ;
246252
253+ // Format text with margins
247254 text[ range. 0 . expect ( "One character at line" ) ..range. 1 ] . fmt ( f) ?;
248255
249256if cut_right{