Revision: 12815
          http://sourceforge.net/p/skim-app/code/12815
Author:   hofman
Date:     2022-03-20 22:21:53 +0000 (Sun, 20 Mar 2022)
Log Message:
-----------
Allow hyphenated words in page break

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

Modified: trunk/PDFSelection_SKExtensions.m
===================================================================
--- trunk/PDFSelection_SKExtensions.m   2022-03-20 16:02:34 UTC (rev 12814)
+++ trunk/PDFSelection_SKExtensions.m   2022-03-20 22:21:53 UTC (rev 12815)
@@ -78,16 +78,22 @@
     return [[self safeFirstPage] displayLabel];
 }
 
-static BOOL inline isHyphenated(NSString *string, PDFSelection *lastLine, 
PDFSelection *line) {
+static BOOL inline isHyphenated(NSString *string, PDFSelection *line, 
PDFSelection *nextLine) {
     NSUInteger l = [string length];
     unichar ch = [string characterAtIndex:l - 1];
     if (ch != SOFT_HYPHEN_CHARACTER && (ch != HYPHEN_CHARACTER || l < 2 || 
[[NSCharacterSet letterCharacterSet] characterIsMember:[string 
characterAtIndex:l - 2]] == NO))
         return NO;
-    PDFPage *page = [lastLine safeLastPage];
-    if ([[line safeFirstPage] isEqual:page] == NO)
+    PDFPage *page = [line safeLastPage];
+    PDFPage *nextPage = [nextLine safeFirstPage];
+    if ([nextPage isEqual:page] == NO && [nextPage pageIndex] != [page 
pageIndex] + 1)
         return NO;
-    NSUInteger i = [lastLine safeIndexOfLastCharacterOnPage:page];
-    NSUInteger j = [line safeIndexOfFirstCharacterOnPage:page];
+    NSUInteger i = [line safeIndexOfLastCharacterOnPage:page];
+    NSUInteger j = [nextLine safeIndexOfFirstCharacterOnPage:nextPage];
+    if (nextPage != page) {
+        if (j > 0)
+            return NO;
+        j = [[page string] length];
+    }
     return i + 1 == j || (i + 2 == j && [[NSCharacterSet 
whitespaceAndNewlineCharacterSet] characterIsMember:[[page string] 
characterAtIndex:i + 1]]);
 }
 

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



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to