Revision: 5600
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5600&view=rev
Author:   hofman
Date:     2009-08-30 09:39:05 +0000 (Sun, 30 Aug 2009)

Log Message:
-----------
avoid a hang when removing whitespace from string displayed by preview tooltip

Modified Paths:
--------------
    trunk/SKPDFToolTipWindow.m

Modified: trunk/SKPDFToolTipWindow.m
===================================================================
--- trunk/SKPDFToolTipWindow.m  2009-08-29 16:20:08 UTC (rev 5599)
+++ trunk/SKPDFToolTipWindow.m  2009-08-30 09:39:05 UTC (rev 5600)
@@ -291,18 +291,13 @@
             
             text = [context text];
             string = [text string];
-            NSUInteger i = 0, l = [string length];
+            NSUInteger i, l = [string length];
             NSRange r = NSMakeRange(0, l);
             
-            while (i != NSNotFound) {
+            while (NSNotFound != (i = [string 
rangeOfCharacterFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] 
options:NSAnchoredSearch range:r].location))
                 r = NSMakeRange(i, l - i);
-                i = [string rangeOfCharacterFromSet:[NSCharacterSet 
whitespaceAndNewlineCharacterSet] options:NSAnchoredSearch range:r].location;
-            }
-            i = l;
-            while (i != NSNotFound) {
+            while (NSNotFound != (i = [string 
rangeOfCharacterFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] 
options:NSBackwardsSearch | NSAnchoredSearch range:r].location))
                 r.length = i - r.location;
-                i = [string rangeOfCharacterFromSet:[NSCharacterSet 
whitespaceAndNewlineCharacterSet] options:NSBackwardsSearch | NSAnchoredSearch 
range:r].location;
-            }
             if (r.length < l)
                 text = [text attributedSubstringFromRange:r];
             


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to