Revision: 16098
          http://sourceforge.net/p/skim-app/code/16098
Author:   hofman
Date:     2026-03-24 17:37:48 +0000 (Tue, 24 Mar 2026)
Log Message:
-----------
use splitviewitems directly to select a search field

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

Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m      2026-03-24 17:22:46 UTC (rev 
16097)
+++ trunk/SKMainWindowController_Actions.m      2026-03-24 17:37:48 UTC (rev 
16098)
@@ -788,35 +788,43 @@
 - (IBAction)searchPDF:(id)sender {
     if ([self hasOverview]) {
         [self hideOverviewAnimating:YES completionHandler:^{ [self 
searchPDF:sender]; }];
-        return;
+    } else {
+        NSSplitViewItem *item = [[splitViewController splitViewItems] 
firstObject];
+        if ([item isCollapsed] == NO) {
+            [leftSideController.searchField selectText:nil];
+        } else if ([NSView shouldShowSlideAnimation]) {
+            // workaround for an AppKit bug: when selecting immediately before 
the animation, the search fields does not display its text
+            [NSAnimationContext runAnimationGroup:^(NSAnimationContext 
*context){
+                    [[item animator] setCollapsed:NO];
+                } completionHandler:^{
+                    [leftSideController.searchField selectText:nil];
+                }];
+        } else {
+            [item setCollapsed:NO];
+            [leftSideController.searchField selectText:nil];
+        }
     }
-    BOOL animating = NO;
-    if ([self leftSidePaneIsOpen] == NO) {
-        animating = [NSView shouldShowSlideAnimation];
-        [self toggleLeftSidePane:sender];
-    }
-    // workaround for an AppKit bug: when selecting immediately before the 
animation, the search fields does not display its text
-    if (animating)
-        [leftSideController.searchField performSelector:@selector(selectText:) 
withObject:nil afterDelay:0.25];
-    else
-        [leftSideController.searchField selectText:self];
 }
 
 - (IBAction)filterNotes:(id)sender {
     if ([self hasOverview]) {
         [self hideOverviewAnimating:YES completionHandler:^{ [self 
filterNotes:sender]; }];
-        return;
+    } else {
+        NSSplitViewItem *item = [[splitViewController splitViewItems] 
lastObject];
+        if ([item isCollapsed] == NO) {
+            [rightSideController.searchField selectText:nil];
+        } else if ([NSView shouldShowSlideAnimation]) {
+            // workaround for an AppKit bug: when selecting immediately before 
the animation, the search fields does not display its text
+            [NSAnimationContext runAnimationGroup:^(NSAnimationContext 
*context){
+                    [[item animator] setCollapsed:NO];
+                } completionHandler:^{
+                    [rightSideController.searchField selectText:nil];
+                }];
+        } else {
+            [item setCollapsed:NO];
+            [rightSideController.searchField selectText:nil];
+        }
     }
-    BOOL animating = NO;
-    if ([self rightSidePaneIsOpen] == NO) {
-        animating = [NSView shouldShowSlideAnimation];
-        [self toggleRightSidePane:sender];
-    }
-    // workaround for an AppKit bug: when selecting immediately before the 
animation, the search fields does not display its text
-    if (animating)
-        [rightSideController.searchField 
performSelector:@selector(selectText:) withObject:nil afterDelay:0.25];
-    else
-        [rightSideController.searchField selectText:self];
 }
 
 - (IBAction)search:(id)sender {

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