Skip to content

Commit

Permalink
Fix .targetFolderNodes(for:) in file browser
Browse files Browse the repository at this point in the history
  • Loading branch information
1024jp committed Sep 30, 2024
1 parent 7d6d337 commit 6f8bbe7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

### Fixes

- Fix an issue in the file browser that some actions for the root folder were incorrectly disabled.
- Fix an issue that changes of insertion formats in the Snippets settings pane were not saved.
- Fix an issue that the initial visibility state of the navigation bar was reversed.
- [trivial] Fix an issue that the action name of the “Shift Left” action is not noted to the undo history.
- [trivial] Fix an issue that the action name of the “Shift Left” action is not noted in the undo history.



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,14 +539,14 @@ final class FileBrowserViewController: NSViewController, NSMenuItemValidation {
}


/// Returns the target file node for the menu action.
/// Returns the target file nodes to perform the for the menu action.
///
/// - Parameter menuItem: The sender of the action.
/// - Returns: A file node.
/// - Returns: File nodes.
private func targetNodes(for sender: Any?) -> [FileNode] {

self.targetRows(for: sender)
.compactMap { self.outlineView.item(atRow: $0) as? FileNode ?? self.document.fileNode }
.compactMap { self.outlineView.item(atRow: $0) as? FileNode }
}


Expand All @@ -558,6 +558,10 @@ final class FileBrowserViewController: NSViewController, NSMenuItemValidation {

let targetNodes = self.targetNodes(for: sender)

if targetNodes.isEmpty {
return self.document.fileNode
}

guard
targetNodes.count == 1,
let targetNode = targetNodes.first
Expand Down

0 comments on commit 6f8bbe7

Please sign in to comment.