@@ -523,7 +523,7 @@ subroutine format_output_string( self, unit, string, procedure_name, &
523
523
character (* ), intent (in ) :: procedure_name
524
524
character (* ), intent (in ) :: col_indent
525
525
526
- integer :: count, indent_len, index , iostat, length, remain
526
+ integer :: count, indent_len, index_ , iostat, length, remain
527
527
character (256 ) :: iomsg
528
528
529
529
length = len_trim (string)
@@ -551,20 +551,23 @@ subroutine format_first_line()
551
551
return
552
552
else
553
553
554
- do index= self % max_width, 1 , - 1
555
- if ( string (index:index) == ' ' ) exit
556
- end do
554
+ index_ = index ( string (1 :self % max_width), new_line(' a' ))
555
+ if ( index_ == 0 ) then
556
+ do index_= self % max_width, 1 , - 1
557
+ if ( string (index_:index_) == ' ' ) exit
558
+ end do
559
+ end if
557
560
558
- if ( index == 0 ) then
561
+ if ( index_ == 0 ) then
559
562
write ( unit, ' (a)' , err= 999 , iostat= iostat, iomsg= iomsg ) &
560
563
string (1 :self % max_width)
561
564
count = self % max_width
562
565
remain = length - count
563
566
return
564
567
else
565
568
write ( unit, ' (a)' , err= 999 , iostat= iostat, iomsg= iomsg ) &
566
- string (1 :index -1 )
567
- count = index
569
+ string (1 :index_ -1 )
570
+ count = index_
568
571
remain = length - count
569
572
return
570
573
end if
@@ -585,20 +588,24 @@ subroutine format_subsequent_line()
585
588
return
586
589
else
587
590
588
- do index= count+ self % max_width, count+1 , - 1
589
- if ( string (index:index) == ' ' ) exit
590
- end do
591
+ index_ = count + index ( string (count+1 :count+ self % max_width), &
592
+ new_line(' a' ))
593
+ if (index_ == count) then
594
+ do index_= count+ self % max_width, count+1 , - 1
595
+ if ( string (index_:index_) == ' ' ) exit
596
+ end do
597
+ end if
591
598
592
- if ( index == count ) then
599
+ if ( index_ == count ) then
593
600
write ( unit, ' (a)' , err= 999 , iostat= iostat, iomsg= iomsg ) &
594
601
string (count+1 :count+ self % max_width)
595
602
count = count + self % max_width
596
603
remain = length - count
597
604
return
598
605
else
599
606
write ( unit, ' (a)' , err= 999 , iostat= iostat, iomsg= iomsg ) &
600
- string (count+1 :index -1 )
601
- count = index
607
+ string (count+1 :index_ -1 )
608
+ count = index_
602
609
remain = length - count
603
610
return
604
611
end if
@@ -611,19 +618,24 @@ end subroutine format_subsequent_line
611
618
612
619
subroutine indent_format_subsequent_line ()
613
620
614
- if ( remain <= self % max_width - indent_len ) then
621
+ if ( index ( string (count+1 :length), new_line(' a' )) == 0 .and. &
622
+ remain <= self % max_width - indent_len ) then
615
623
write ( unit, ' (a)' , err= 999 , iostat= iostat, iomsg= iomsg ) &
616
624
col_indent // string (count+1 :length)
617
625
count = length
618
626
remain = 0
619
627
return
620
628
else
621
629
622
- do index= count+ self % max_width- indent_len, count+1 , - 1
623
- if ( string (index:index) == ' ' ) exit
624
- end do
630
+ index_ = count + index ( string (count+1 :count+ self % max_width &
631
+ - indent_len), new_line(' a' ))
632
+ if (index_ == count) then
633
+ do index_= count+ self % max_width- indent_len, count+1 , - 1
634
+ if ( string (index_:index_) == ' ' ) exit
635
+ end do
636
+ end if
625
637
626
- if ( index == count ) then
638
+ if ( index_ == count ) then
627
639
write ( unit, ' (a)' , err= 999 , iostat= iostat, iomsg= iomsg ) &
628
640
col_indent // &
629
641
string (count+1 :count+ self % max_width- indent_len)
@@ -632,8 +644,8 @@ subroutine indent_format_subsequent_line()
632
644
return
633
645
else
634
646
write ( unit, ' (a)' , err= 999 , iostat= iostat, iomsg= iomsg ) &
635
- col_indent // string (count+1 :index -1 )
636
- count = index
647
+ col_indent // string (count+1 :index_ -1 )
648
+ count = index_
637
649
remain = length - count
638
650
return
639
651
end if
0 commit comments