Revision: 14001
          http://sourceforge.net/p/skim-app/code/14001
Author:   hofman
Date:     2023-12-28 15:24:17 +0000 (Thu, 28 Dec 2023)
Log Message:
-----------
modify count when removing object

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

Modified: trunk/SKTemplateParser.m
===================================================================
--- trunk/SKTemplateParser.m    2023-12-28 00:04:45 UTC (rev 14000)
+++ trunk/SKTemplateParser.m    2023-12-28 15:24:17 UTC (rev 14001)
@@ -472,10 +472,12 @@
         NSString *string = [tag text];
         NSRange range = rangeAfterRemovingEmptyLines(string, i > 0 ? 
[(SKTemplateTag *)[result objectAtIndex:i - 1] type] : SKNoTemplateTagType, i < 
count - 1 ? [(SKTemplateTag *)[result objectAtIndex:i + 1] type] : 
SKNoTemplateTagType, isSubtemplate);
         
-        if (range.length == 0)
+        if (range.length == 0) {
             [result removeObjectAtIndex:i];
-        else if (range.length != [string length])
+            --count;
+        } else if (range.length != [string length]) {
             [tag setText:[string substringWithRange:range]];
+        }
     }
     
     return result;    
@@ -707,10 +709,12 @@
         NSString *string = [attrString string];
         NSRange range = rangeAfterRemovingEmptyLines(string, i > 0 ? 
[(SKTemplateTag *)[result objectAtIndex:i - 1] type] : SKNoTemplateTagType, i < 
count - 1 ? [(SKTemplateTag *)[result objectAtIndex:i + 1] type] : 
SKNoTemplateTagType, isSubtemplate);
         
-        if (range.length == 0)
+        if (range.length == 0) {
             [result removeObjectAtIndex:i];
-        else if (range.length != [string length])
+            --count;
+        } else if (range.length != [string length]) {
             [tag setAttributedText:[attrString 
attributedSubstringFromRange:range]];
+        }
     }
     
     return result;    

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to