/[classpath]/classpath/javax/swing/text/GapContent.java
ViewVC logotype

Diff of /classpath/javax/swing/text/GapContent.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5.2.7 by gnu_andrew, Tue Aug 16 16:22:38 2005 UTC revision 1.5.2.8 by gnu_andrew, Sat Sep 10 15:31:55 2005 UTC
# Line 114  public class GapContent Line 114  public class GapContent
114       */       */
115      public int getOffset()      public int getOffset()
116      {      {
117        if (mark <= gapStart)        if (mark <= gapEnd)
118          return mark;          return mark;
119        else        else
120          return mark - (gapEnd - gapStart);          return mark - (gapEnd - gapStart);
# Line 274  public class GapContent Line 274  public class GapContent
274    public String getString(int where, int len) throws BadLocationException    public String getString(int where, int len) throws BadLocationException
275    {    {
276      Segment seg = new Segment();      Segment seg = new Segment();
277      getChars(where, len, seg);      try
278      return new String(seg.array, seg.offset, seg.count);        {
279            getChars(where, len, seg);
280            return new String(seg.array, seg.offset, seg.count);
281          }
282        catch (StringIndexOutOfBoundsException ex)
283          {
284            int invalid = 0;
285            if (seg.offset < 0 || seg.offset >= seg.array.length)
286              invalid = seg.offset;
287            else
288              invalid = seg.offset + seg.count;
289            throw new BadLocationException("Illegal location: array.length = "
290                                           + seg.array.length + ", offset = "
291                                           + seg.offset + ", count = "
292                                           + seg.count, invalid);
293          }
294    }    }
295    
296    /**    /**
# Line 357  public class GapContent Line 372  public class GapContent
372      if (index < 0)      if (index < 0)
373        index = -(index + 1);        index = -(index + 1);
374      positions.add(index, pos);      positions.add(index, pos);
375        
376      return pos;      return pos;
377    }    }
378    

Legend:
Removed from v.1.5.2.7  
changed lines
  Added in v.1.5.2.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26