Bug 21866

Summary: wordWrap incorrect behavior with delimiter
Product: Taglibs Reporter: Vladyslav Kosulin <kosulin>
Component: String TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: critical    
Priority: P3    
Version: 1.0.1   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Vladyslav Kosulin 2003-07-24 20:49:33 UTC
if I use
<str:wordWrap width="15"
delimiter="&lt;BR&gt;">1234567890123456789012345</str:wordWrap>
I get the following output:
123456<BR>789012<BR>345678<BR>901234<BR>5 
It looks like it calculates the delimiter length (10 characters in this case)
and adds it to the length of the string to be split to compare to the width+1.
I guess, this is not an expected behavior. It should treat the delimiter out of
calculations and apply width to the string itself.
Comment 1 Felipe Leme 2004-03-09 01:12:35 UTC
Vladyslav,

This tag definition states that: this involves formatting a long String to fit
within a certain character width of page.

So, if we don't take the delimiter's length into account, the chunks won't fit
into that width.

On the other hand, it also says that: A delimiter may be passed in to put at the
end of each line.

In other words, the current definition is dubious about where the delimiter
should be include. So, I will fix this bug including a new attribute for the tag:

delimiterInside - flag indicating if the delimiter should be included in chunk
before length reaches width. Default is true.


Comment 2 Felipe Leme 2004-03-10 03:28:40 UTC
Fixed (and new version available through nightly build)