Revision: 16265
http://sourceforge.net/p/skim-app/code/16265
Author: hofman
Date: 2026-05-09 22:22:50 +0000 (Sat, 09 May 2026)
Log Message:
-----------
set search result index before updating selection instead of passing direction
argument
Modified Paths:
--------------
trunk/SKMainWindowController.h
trunk/SKMainWindowController.m
trunk/SKMainWindowController_Actions.m
trunk/SKMainWindowController_UI.m
Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h 2026-05-09 22:15:16 UTC (rev 16264)
+++ trunk/SKMainWindowController.h 2026-05-09 22:22:50 UTC (rev 16265)
@@ -273,7 +273,7 @@
- (void)showFindBar;
--
(void)updateSearchResultHighlightsForDirection:(NSSelectionDirection)direction;
+- (void)updateSearchResultHighlights;
- (BOOL)isOutlineExpanded:(PDFOutline *)outline;
- (void)setExpanded:(BOOL)flag forOutline:(PDFOutline *)outline;
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2026-05-09 22:15:16 UTC (rev 16264)
+++ trunk/SKMainWindowController.m 2026-05-09 22:22:50 UTC (rev 16265)
@@ -209,8 +209,6 @@
- (void)updatePageLabel;
--
(void)updateSearchResultHighlightsForDirection:(NSSelectionDirection)direction;
-
- (void)registerForDocumentNotifications;
- (void)unregisterForDocumentNotifications;
@@ -1365,7 +1363,8 @@
mwcFlags.findPaneState = newFindPaneState;
[leftSideController displayTableAtIndex:2 + mwcFlags.findPaneState];
- [self updateSearchResultHighlightsForDirection:NSDirectSelection];
+ searchResultIndex = 0;
+ [self updateSearchResultHighlights];
} else if ([self displaysFindPane] == NO) {
@@ -1947,7 +1946,7 @@
}
}
--
(void)updateSearchResultHighlightsForDirection:(NSSelectionDirection)direction {
+- (void)updateSearchResultHighlights {
NSArray *findResults = nil;
if (mwcFlags.findPaneState == SKFindPaneStateSingular &&
[leftSideController.findTableView window])
@@ -1963,15 +1962,10 @@
} else {
- if (direction == NSDirectSelection) {
+ if (searchResultIndex >= (NSInteger)[findResults count])
searchResultIndex = 0;
- } else if (direction == NSSelectingNext) {
- if (++searchResultIndex >= (NSInteger)[findResults count])
- searchResultIndex = 0;
- } else if (direction == NSSelectingPrevious) {
- if (--searchResultIndex < 0)
- searchResultIndex = [findResults count] - 1;
- }
+ else if (searchResultIndex < 0)
+ searchResultIndex = [findResults count] - 1;
PDFSelection *currentSel = [findResults
objectAtIndex:searchResultIndex];
Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m 2026-05-09 22:15:16 UTC (rev
16264)
+++ trunk/SKMainWindowController_Actions.m 2026-05-09 22:22:50 UTC (rev
16265)
@@ -259,7 +259,8 @@
- (void)goToSelectedFindResults:(id)sender {
if ([sender numberOfSelectedRows] > 0) {
- [self updateSearchResultHighlightsForDirection:NSDirectSelection];
+ searchResultIndex = 0;
+ [self updateSearchResultHighlights];
if ([self interactionMode] == SKPresentationMode && [[NSUserDefaults
standardUserDefaults] boolForKey:SKAutoHidePresentationContentsKey])
[self hideSideWindow];
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2026-05-09 22:15:16 UTC (rev 16264)
+++ trunk/SKMainWindowController_UI.m 2026-05-09 22:22:50 UTC (rev 16265)
@@ -602,7 +602,8 @@
} else if ([tv isEqual:leftSideController.findTableView] ||
[tv isEqual:leftSideController.groupedFindTableView]) {
if (mwcFlags.updatingFindResults == 0) {
- [self updateSearchResultHighlightsForDirection:NSDirectSelection];
+ searchResultIndex = 0;
+ [self updateSearchResultHighlights];
if ([self interactionMode] == SKPresentationMode &&
[[NSUserDefaults standardUserDefaults]
boolForKey:SKAutoHidePresentationContentsKey])
[self hideSideWindow];
@@ -769,15 +770,19 @@
- (void)tableViewMoveLeft:(NSTableView *)tv {
if (([tv isEqual:leftSideController.findTableView] || [tv
isEqual:leftSideController.groupedFindTableView])) {
- if ([tv numberOfSelectedRows])
- [self
updateSearchResultHighlightsForDirection:NSSelectingPrevious];
+ if ([tv numberOfSelectedRows]) {
+ ++searchResultIndex;
+ [self updateSearchResultHighlights];
+ }
}
}
- (void)tableViewMoveRight:(NSTableView *)tv {
if (([tv isEqual:leftSideController.findTableView] || [tv
isEqual:leftSideController.groupedFindTableView])) {
- if ([tv numberOfSelectedRows])
- [self updateSearchResultHighlightsForDirection:NSSelectingNext];
+ if ([tv numberOfSelectedRows]) {
+ --searchResultIndex;
+ [self updateSearchResultHighlights];
+ }
}
}
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