gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java


From: Benja Fallenstein
Subject: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java
Date: Sun, 22 Sep 2002 15:12:37 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      02/09/22 15:12:37

Modified files:
        gzz/view       : LinebrokenCellContentView.java 

Log message:
        OUCH. Fix the linebreaking bug that occured on my, but not on Tuomas' 
machine.
        
        PLEASE read the comment in the diff. GRRRR...

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/LinebrokenCellContentView.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text

Patches:
Index: gzz/gzz/view/LinebrokenCellContentView.java
diff -c gzz/gzz/view/LinebrokenCellContentView.java:1.4 
gzz/gzz/view/LinebrokenCellContentView.java:1.5
*** gzz/gzz/view/LinebrokenCellContentView.java:1.4     Sat Sep 21 17:49:04 2002
--- gzz/gzz/view/LinebrokenCellContentView.java Sun Sep 22 15:12:37 2002
***************
*** 38,44 ****
   */
  
  public class LinebrokenCellContentView implements CellContentView {
! public static final String rcsid = "$Id: LinebrokenCellContentView.java,v 1.4 
2002/09/21 21:49:04 benja Exp $";
      public static boolean dbg = false;
      private static void p(String s) { if(dbg) pa(s); }
      private static void pa(String s) { System.err.println(s); }
--- 38,44 ----
   */
  
  public class LinebrokenCellContentView implements CellContentView {
! public static final String rcsid = "$Id: LinebrokenCellContentView.java,v 1.5 
2002/09/22 19:12:37 benja Exp $";
      public static boolean dbg = false;
      private static void p(String s) { if(dbg) pa(s); }
      private static void pa(String s) { System.err.println(s); }
***************
*** 105,110 ****
--- 105,136 ----
                             float scale) {
          Object key = new Integer(start+1472);
        s = s.substring(start, end);
+ 
+       /**
+         (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;
+ 
        if(dbg) pa("addVobs: "+start+" "+end+" '"+s+"'");
          TextVob vob = new TextVob(style, scale, s, key);
          ch.addBox(vob);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]