diff options
Diffstat (limited to 'render.f90')
-rw-r--r-- | render.f90 | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -296,7 +296,7 @@ contains integer, intent(in)::startpos integer, intent(in)::proportional_type integer::endpos - integer::my_start + integer::my_start, last_end integer::w my_start = startpos @@ -306,15 +306,25 @@ contains endpos = len_trim(text) w = width_of_line(r, text, my_start, endpos, proportional_type) - do while(w > r%max_width) - - endpos = endpos - 1 - do while(text(endpos:endpos) /= ' ' .and. text(endpos:endpos) /= '-' .and. endpos > my_start) - endpos = endpos - 1 + if(w > r%max_width) then + + w = 0 + endpos = startpos+1 + do while(w <= r%max_width) + + last_end = endpos + endpos = endpos + 1 + do while(text(endpos:endpos) /= ' ' .and. text(endpos:endpos) /= '-') + endpos = endpos + 1 + end do + + w = width_of_line(r, text, my_start, endpos, proportional_type) + end do - w = width_of_line(r, text, my_start, endpos, proportional_type) - end do + endpos = last_end + + end if end function wrap_line |