bug-gnustep
[Top][All Lists]
Advanced

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

GSSimpleLayoutManager line range problem


From: Alexander Malmberg
Subject: GSSimpleLayoutManager line range problem
Date: Mon, 04 Mar 2002 00:51:17 +0100

Hi,

It seems that under some circumstances (seemed to happen with windows
with really small width) in [GSSimpleLayoutManager -textStorage: edited:
range: changeInLength: invalidatedRange:], the call to sizeToFit or
invalidateTextContainerOrigin ends up causing additional calls to
rebuildForRange:... (four when I've tested), and the further rebuilds
cause the number of lines to decrease, and thus the line range used in
setNeedsDisplayForLineRange:... won't be valid. This causes an exception
in setNeedsDisplayForLineRange:...

I've attached a patch that makes setNeedsDisplayForLineRange return if
the line range is too large. I think this is correct if the other calls
make sure that they update the display properly. However, I haven't
investigated why there are so many calls to rebuildForRange:...

- Alexander Malmberg
Index: GSSimpleLayoutManager.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/GSSimpleLayoutManager.m,v
retrieving revision 1.26
diff -u -r1.26 GSSimpleLayoutManager.m
--- GSSimpleLayoutManager.m     27 Feb 2002 23:35:05 -0000      1.26
+++ GSSimpleLayoutManager.m     3 Mar 2002 23:32:12 -0000
@@ -735,8 +735,8 @@
                     inTextContainer: (NSTextContainer *)aTextContainer 
 {
   if ([_lineLayoutInformation count]
-      && redrawLineRange.location < [_lineLayoutInformation count]
-      && redrawLineRange.length)
+      && redrawLineRange.location+redrawLineRange.length <= 
[_lineLayoutInformation count]
+      && redrawLineRange.length )
     {
       _GNULineLayoutInfo *firstInfo
        = [_lineLayoutInformation objectAtIndex: redrawLineRange.location];

reply via email to

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