Revision: 16040
          http://sourceforge.net/p/skim-app/code/16040
Author:   hofman
Date:     2026-02-06 17:29:43 +0000 (Fri, 06 Feb 2026)
Log Message:
-----------
pass page index hint in page index pointer parameter

Modified Paths:
--------------
    trunk/SKPDFSyncParser.m
    trunk/SKPDFSynchronizer.h
    trunk/SKPDFSynchronizer.m
    trunk/SKSyncTeXParser.m

Modified: trunk/SKPDFSyncParser.m
===================================================================
--- trunk/SKPDFSyncParser.m     2026-02-06 17:12:28 UTC (rev 16039)
+++ trunk/SKPDFSyncParser.m     2026-02-06 17:29:43 UTC (rev 16040)
@@ -251,8 +251,9 @@
     return rv;
 }
 
-- (BOOL)findPage:(NSUInteger *)pageIndexPtr location:(NSPoint *)pointPtr 
forLine:(NSInteger)line inFile:(NSString *)file 
fromPageIndex:(NSUInteger)pageIndex {
+- (BOOL)findPage:(NSUInteger *)pageIndexPtr location:(NSPoint *)pointPtr 
forLine:(NSInteger)line inFile:(NSString *)file {
     BOOL rv = NO;
+    NSUInteger pageIndex = *pageIndexPtr == NSNotFound ? 0 : *pageIndexPtr;
     NSArray *theLines = [lines objectForKey:file];
     if (theLines) {
         

Modified: trunk/SKPDFSynchronizer.h
===================================================================
--- trunk/SKPDFSynchronizer.h   2026-02-06 17:12:28 UTC (rev 16039)
+++ trunk/SKPDFSynchronizer.h   2026-02-06 17:29:43 UTC (rev 16040)
@@ -100,7 +100,7 @@
 - (void)enumerateSourceFilesUsingBlock:(void (^)(NSString *file))block;
 
 - (BOOL)findFile:(NSString * _Nullable __autoreleasing * _Nonnull)filePtr 
line:(NSInteger *)linePtr forLocation:(NSPoint)point inRect:(NSRect)rect 
pageBounds:(NSRect)bounds atPageIndex:(NSUInteger)pageIndex;
-- (BOOL)findPage:(NSUInteger *)pageIndexPtr location:(NSPoint *)pointPtr 
forLine:(NSInteger)line inFile:(nullable NSString *)file 
fromPageIndex:(NSUInteger)pageIndex;
+- (BOOL)findPage:(NSUInteger *)pageIndexPtr location:(NSPoint *)pointPtr 
forLine:(NSInteger)line inFile:(nullable NSString *)file;
 
 @end
 

Modified: trunk/SKPDFSynchronizer.m
===================================================================
--- trunk/SKPDFSynchronizer.m   2026-02-06 17:12:28 UTC (rev 16039)
+++ trunk/SKPDFSynchronizer.m   2026-02-06 17:29:43 UTC (rev 16040)
@@ -232,7 +232,7 @@
         file = [self defaultSourceFile];
     dispatch_async(queue, ^{
         if (file && atomic_load(&shouldKeepRunning) && [self 
loadSyncFileIfNeeded]) {
-            NSUInteger foundPageIndex = NSNotFound;
+            NSUInteger foundPageIndex = pageIndex;
             NSPoint foundPoint = NSZeroPoint;
             SKPDFSynchronizerOption foundOptions = options;
             BOOL success = NO;
@@ -249,7 +249,7 @@
                 if (sourceFile == nil)
                     sourceFile = fixedFile;
             }
-            success = [parser findPage:&foundPageIndex location:&foundPoint 
forLine:line inFile:sourceFile fromPageIndex:pageIndex];
+            success = [parser findPage:&foundPageIndex location:&foundPoint 
forLine:line inFile:sourceFile];
             
             if (success && atomic_load(&shouldKeepRunning)) {
                 if (isPdfsync)

Modified: trunk/SKSyncTeXParser.m
===================================================================
--- trunk/SKSyncTeXParser.m     2026-02-06 17:12:28 UTC (rev 16039)
+++ trunk/SKSyncTeXParser.m     2026-02-06 17:29:43 UTC (rev 16040)
@@ -91,10 +91,11 @@
     return rv;
 }
 
-- (BOOL)findPage:(NSUInteger *)pageIndexPtr location:(NSPoint *)pointPtr 
forLine:(NSInteger)line inFile:(NSString *)file 
fromPageIndex:(NSUInteger)pageIndex  {
+- (BOOL)findPage:(NSUInteger *)pageIndexPtr location:(NSPoint *)pointPtr 
forLine:(NSInteger)line inFile:(NSString *)file {
     BOOL rv = NO;
     const char *filename = [file UTF8String];
-    if (synctex_display_query(scanner, filename, (int)line + 1, 0, pageIndex + 
1) > 0) {
+    NSUInteger pageIndex = *pageIndexPtr == NSNotFound ? 0 : 1 + *pageIndexPtr;
+    if (synctex_display_query(scanner, filename, (int)line + 1, 0, pageIndex) 
> 0) {
         synctex_node_p node = synctex_scanner_next_result(scanner);
         if (node) {
             NSUInteger page = synctex_node_page(node);

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