Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Icon Type setting reflects immediately #1765 #1773

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ final class ProjectNavigatorViewController: NSViewController {

var workspace: WorkspaceDocument?

var iconColor: SettingsData.FileIconStyle = .color
var iconColor: SettingsData.FileIconStyle = .color {
willSet {
if newValue != iconColor {
outlineView.reloadData()
}
}
}

var fileExtensionsVisibility: SettingsData.FileExtensionsVisibility = .showAll
var shownFileExtensions: SettingsData.FileExtensions = .default
Expand Down Expand Up @@ -275,9 +281,7 @@ extension ProjectNavigatorViewController: NSOutlineViewDelegate {
}

func outlineViewSelectionDidChange(_ notification: Notification) {
guard let outlineView = notification.object as? NSOutlineView else {
return
}
guard let outlineView = notification.object as? NSOutlineView else { return }

let selectedIndex = outlineView.selectedRow

Expand All @@ -298,13 +302,9 @@ extension ProjectNavigatorViewController: NSOutlineViewDelegate {
guard
let id = workspace?.editorManager.activeEditor.selectedTab?.file.id,
let item = workspace?.workspaceFileManager?.getFile(id, createIfNotFound: true)
else {
return
}
else { return }
/// update outline selection only if the parent of selected item match with expanded item
guard item.parent === notification.userInfo?["NSObject"] as? CEWorkspaceFile else {
return
}
guard item.parent === notification.userInfo?["NSObject"] as? CEWorkspaceFile else { return }
/// select active file under collapsed folder only if its parent is expanding
if outlineView.isItemExpanded(item.parent) {
updateSelection(itemID: item.id)
Expand Down
Loading