108 |
Object key = new Integer(start+1472); |
Object key = new Integer(start+1472); |
109 |
s = s.substring(start, end); |
s = s.substring(start, end); |
110 |
|
|
|
/** |
|
|
(Benja:) Ouch. The following line makes a great difference, even though |
|
|
that should really not be so. |
|
|
|
|
|
Without this line, on *my* system (though not Tuomas'!), the text vobs |
|
|
added by this method extend from 'start' till 's.length()'-- 'end' |
|
|
seems to be ignored. That is, if 's' is "Foo bar baz", 'start' is 4 |
|
|
and 'end' is 8, the text shown on the screen is not "bar ", as intended, |
|
|
but "bar baz". (The width used in linebreaking is "bar ", though.) |
|
|
|
|
|
This means two things, apparently: |
|
|
o My JVM handles substring() virtually, so 's.substring(start, end)' |
|
|
is not a copy of a part of 's', but a subrange of the memory range |
|
|
occupied by 's', starting at 'start' and spanning 'end-start' |
|
|
characters. '""+s', on the other hand, creates a copy of 's'. |
|
|
o Something on the C++ side does not respect the string length passed |
|
|
to it by the JVM (it presumably thinks the string is |
|
|
NUL-terminated). So, it displays all the text starting at 'start' |
|
|
till the end of 's'. |
|
|
|
|
|
Therefore, please don't remove the following line until you can be sure |
|
|
the bug explained above has been fixed... |
|
|
**/ |
|
|
s = ""+s; |
|
|
|
|
111 |
if(dbg) pa("addVobs: "+start+" "+end+" '"+s+"'"); |
if(dbg) pa("addVobs: "+start+" "+end+" '"+s+"'"); |
112 |
TextVob vob = new TextVob(style, s, true, key); |
TextVob vob = new TextVob(style, s, true, key); |
113 |
ch.addBox(vob); |
ch.addBox(vob); |