Skip to content

Commit 5765be0

Browse files
Matteo SavoiaMatteo Savoia
authored andcommitted
Update project files and gitignore
1 parent eb81883 commit 5765be0

4 files changed

Lines changed: 39 additions & 10 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
xcuserdata/
1+
xcuserdata/
2+
build/
3+
.DS_Store

FlowVision/Sources/ViewController.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,13 @@ class ViewController: NSViewController, NSSplitViewDelegate, NSSearchFieldDelega
10031003
return
10041004
}
10051005

1006+
if item.name == ".." {
1007+
if let url = URL(string: item.fullPath) {
1008+
changeTreeRoot(to: url.path)
1009+
}
1010+
return
1011+
}
1012+
10061013
guard let url = URL(string: item.fullPath) else { return }
10071014

10081015
// Handle special cases like virtual tags

FlowVision/Sources/Views/CustomOutlineViewManager.swift

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ extension CustomOutlineViewManager: NSOutlineViewDataSource {
3838
guard let treeNode = item as? TreeNode else {
3939
return false
4040
}
41+
if treeNode.name == ".." {
42+
return false
43+
}
4144
if (treeNode.children?.count ?? 0) > 0 {
4245
return true
4346
}
@@ -97,16 +100,19 @@ extension CustomOutlineViewManager: NSOutlineViewDelegate {
97100

98101
func itemSelected(_ item: TreeNode) {
99102
if ifActWhenSelected {
100-
// log("Selected item: \(item.name)")
101-
// fileDB.lock()
102-
// let lastFolderPath = fileDB.curFolder
103-
// fileDB.curFolder = item.fullPath
104-
// log(fileDB.curFolder)
105-
// fileDB.unlock()
106-
// getViewController(self)!.publicVar.folderStepStack.insert(lastFolderPath, at: 0)
107-
getViewController(outlineView!)?.switchDirByDirection(direction: .zero, dest: item.fullPath, doCollapse: false, expandLast: false, skip: false, stackDeep: 0)
103+
if item.name == ".." {
104+
// Do nothing on single click
105+
} else {
106+
// log("Selected item: \(item.name)")
107+
// fileDB.lock()
108+
// let lastFolderPath = fileDB.curFolder
109+
// fileDB.curFolder = item.fullPath
110+
// log(fileDB.curFolder)
111+
// fileDB.unlock()
112+
// getViewController(self)!.publicVar.folderStepStack.insert(lastFolderPath, at: 0)
113+
getViewController(outlineView!)?.switchDirByDirection(direction: .zero, dest: item.fullPath, doCollapse: false, expandLast: false, skip: false, stackDeep: 0)
114+
}
108115
}
109-
110116
}
111117
func outlineView(_ outlineView: NSOutlineView, rowViewForItem item: Any) -> NSTableRowView? {
112118
return CustomTableRowView()

pull_request_description.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Title: feat: Implement persistent, focused root directory for sidebar with '..' navigation
2+
3+
Description:
4+
This Pull Request introduces a new feature to enhance sidebar management, providing more granular control over directory viewing and improving user navigation.
5+
6+
Key Changes:
7+
8+
- Custom Root Directory: Double-clicking a folder in the sidebar now sets it as the new "root" of the tree view. The sidebar will then display only the contents of that folder and its subfolders, hiding the rest of the higher hierarchy.
9+
- Upward Navigation (`..`): If the current root directory is not the filesystem's root, a special ".." entry is added at the beginning of the list of children for the current root folder. Double-clicking ".." will navigate up one level in the directory hierarchy.
10+
- Persistence on Launch: The selected root directory is saved in the application's preferences. Upon subsequent launches, the application will automatically start from this directory, maintaining the user's preferred sidebar configuration.
11+
12+
Motivation:
13+
14+
These changes significantly improve usability for users working with deep repositories or folder structures, allowing them to focus the directory tree on a relevant part of the filesystem and easily restore that context on each launch.

0 commit comments

Comments
 (0)