Skip to content

Commit 6be722f

Browse files
Merge branch 'CodeEditApp:main' into select-multiple-files
2 parents 75d1adf + d92b5d9 commit 6be722f

File tree

8 files changed

+53
-50
lines changed

8 files changed

+53
-50
lines changed

β€Ž.all-contributorsrcβ€Ž

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,15 @@
776776
"contributions": [
777777
"code"
778778
]
779+
},
780+
{
781+
"login": "Kihron",
782+
"name": "Kihron",
783+
"avatar_url": "https://avatars.githubusercontent.com/u/30128800?v=4",
784+
"profile": "https://github.com/Kihron",
785+
"contributions": [
786+
"bug"
787+
]
779788
}
780789
],
781790
"contributorsPerLine": 7,

β€ŽCodeEdit/AppDelegate.swiftβ€Ž

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,15 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
6969
}
7070

7171
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
72-
if flag {
72+
guard flag else {
73+
handleOpen()
7374
return false
7475
}
7576

76-
handleOpen()
77-
77+
/// Check if all windows are either miniaturized or not visible.
78+
/// If so, attempt to find the first miniaturized window and deminiaturize it.
79+
guard sender.windows.allSatisfy({ $0.isMiniaturized || !$0.isVisible }) else { return false }
80+
sender.windows.first(where: { $0.isMiniaturized })?.deminiaturize(sender)
7881
return false
7982
}
8083

β€ŽCodeEdit/Features/Editor/TabBar/Views/EditorTabBarContextMenu.swiftβ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ struct EditorTabBarContextMenu: ViewModifier {
5353
}
5454
}
5555
}
56+
5657
Button("Close Tabs to the Right") {
5758
withAnimation {
58-
if let index = tabs.tabs.firstIndex(where: { $0.file == item }) {
59-
tabs.tabs[index...].forEach {
59+
if let index = tabs.tabs.firstIndex(where: { $0.file == item }), index + 1 < tabs.tabs.count {
60+
tabs.tabs[(index + 1)...].forEach {
6061
tabs.closeTab(file: $0.file)
6162
}
6263
}

β€ŽCodeEdit/Features/Editor/Views/CodeFileView.swiftβ€Ž

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,10 @@ struct CodeFileView: View {
8080
.textUpdatePublisher
8181
.debounce(for: 1.0, scheduler: DispatchQueue.main)
8282
.sink { _ in
83+
// updateChangeCount is automatically managed by autosave(), so no manual call is necessary
8384
codeFile.autosave(withImplicitCancellability: false) { error in
8485
if let error {
8586
CodeFileDocument.logger.error("Failed to autosave document, error: \(error)")
86-
} else {
87-
codeFile.updateChangeCount(.changeCleared)
8887
}
8988
}
9089
}

β€ŽCodeEdit/Features/NavigatorArea/FindNavigator/FindNavigatorResultList/FindNavigatorListViewController.swiftβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ extension FindNavigatorListViewController: NSOutlineViewDelegate {
165165
func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
166166
guard let tableColumn else { return nil }
167167
if let item = item as? SearchResultMatchModel {
168-
let frameRect = NSRect(x: 0, y: 0, width: tableColumn.width, height: CGFloat.greatestFiniteMagnitude)
168+
let frameRect = NSRect(x: 0, y: 0, width: tableColumn.width, height: outlineView.rowHeight)
169169
return FindNavigatorListMatchCell(frame: frameRect, matchItem: item)
170170
} else {
171171
let frameRect = NSRect(

β€ŽCodeEdit/Features/NavigatorArea/FindNavigator/FindNavigatorResultList/FindNavigatorMatchListCell.swiftβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ final class FindNavigatorListMatchCell: NSTableCellView {
2020
x: frame.origin.x,
2121
y: frame.origin.y,
2222
width: frame.width,
23-
height: CGFloat.greatestFiniteMagnitude
23+
height: frame.height
2424
))
2525

2626
// Create the label

β€ŽCodeEdit/Features/NavigatorArea/OutlineView/FileSystemTableViewCell.swiftβ€Ž

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -46,55 +46,45 @@ class FileSystemTableViewCell: StandardTableViewCell {
4646
imageView?.contentTintColor = color(for: item)
4747

4848
let fileName = item.labelFileName()
49+
let fontSize = textField?.font?.pointSize ?? 12
4950

50-
guard let navigatorFilter else {
51+
guard let filter = navigatorFilter?.trimmingCharacters(in: .whitespacesAndNewlines), !filter.isEmpty else {
5152
textField?.stringValue = fileName
5253
return
5354
}
5455

55-
// Apply bold style if the filename matches the workspace filter
56-
if !navigatorFilter.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
57-
let attributedString = NSMutableAttributedString(string: fileName)
58-
59-
// Check if the filename contains the filter text
60-
let range = NSString(string: fileName).range(of: navigatorFilter, options: .caseInsensitive)
61-
if range.location != NSNotFound {
62-
// Set the label color to secondary
63-
attributedString.addAttribute(
64-
.foregroundColor,
65-
value: NSColor.secondaryLabelColor,
66-
range: NSRange(location: 0, length: attributedString.length)
67-
)
68-
69-
// If the filter text matches, bold the matching text and set primary label color
70-
attributedString.addAttributes(
71-
[
72-
.font: NSFont.boldSystemFont(ofSize: textField?.font?.pointSize ?? 12),
73-
.foregroundColor: NSColor.labelColor
74-
],
75-
range: range
76-
)
77-
} else {
78-
// If no match, apply primary label color for parent folder,
79-
// or secondary label color for a non-matching file
80-
attributedString.addAttribute(
81-
.foregroundColor,
82-
value: item.isFolder ? NSColor.labelColor : NSColor.secondaryLabelColor,
83-
range: NSRange(location: 0, length: attributedString.length)
84-
)
85-
}
86-
87-
textField?.attributedStringValue = attributedString
88-
} else {
89-
// If no filter is applied, reset to normal font and primary label color
90-
textField?.attributedStringValue = NSAttributedString(
91-
string: fileName,
92-
attributes: [
93-
.font: NSFont.systemFont(ofSize: textField?.font?.pointSize ?? 12),
56+
let paragraphStyle = NSMutableParagraphStyle()
57+
paragraphStyle.lineBreakMode = .byTruncatingMiddle
58+
59+
/// Initialize default attributes
60+
let attributedString = NSMutableAttributedString(string: fileName, attributes: [
61+
.paragraphStyle: paragraphStyle,
62+
.font: NSFont.systemFont(ofSize: fontSize),
63+
.foregroundColor: NSColor.secondaryLabelColor
64+
])
65+
66+
/// Check if the filename contains the filter text
67+
let range = (fileName as NSString).range(of: filter, options: .caseInsensitive)
68+
if range.location != NSNotFound {
69+
/// If the filter text matches, bold the matching text and set primary label color
70+
attributedString.addAttributes(
71+
[
72+
.font: NSFont.boldSystemFont(ofSize: fontSize),
9473
.foregroundColor: NSColor.labelColor
95-
]
74+
],
75+
range: range
76+
)
77+
} else {
78+
/// If no match, apply primary label color for parent folder,
79+
/// or secondary label color for a non-matching file
80+
attributedString.addAttribute(
81+
.foregroundColor,
82+
value: item.isFolder ? NSColor.labelColor : NSColor.secondaryLabelColor,
83+
range: NSRange(location: 0, length: attributedString.length)
9684
)
9785
}
86+
87+
textField?.attributedStringValue = attributedString
9888
}
9989

10090
func addModel() {

β€ŽREADME.mdβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ For issues we want to focus on that are most relevant at any given time, please
191191
<td align="center" valign="top" width="14.28%"><a href="https://github.com/scaredcr6w"><img src="https://avatars.githubusercontent.com/u/85457088?v=4?s=100" width="100px;" alt="Levente Anda"/><br /><sub><b>Levente Anda</b></sub></a><br /><a href="https://github.com/CodeEditApp/CodeEdit/commits?author=scaredcr6w" title="Code">πŸ’»</a></td>
192192
<td align="center" valign="top" width="14.28%"><a href="https://nobelliu.github.com"><img src="https://avatars.githubusercontent.com/u/10796646?v=4?s=100" width="100px;" alt="Nobel"/><br /><sub><b>Nobel</b></sub></a><br /><a href="https://github.com/CodeEditApp/CodeEdit/commits?author=NobelLiu" title="Code">πŸ’»</a></td>
193193
<td align="center" valign="top" width="14.28%"><a href="https://github.com/SavelyUkuren"><img src="https://avatars.githubusercontent.com/u/125015568?v=4?s=100" width="100px;" alt="Savely"/><br /><sub><b>Savely</b></sub></a><br /><a href="https://github.com/CodeEditApp/CodeEdit/commits?author=SavelyUkuren" title="Code">πŸ’»</a></td>
194+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Kihron"><img src="https://avatars.githubusercontent.com/u/30128800?v=4?s=100" width="100px;" alt="Kihron"/><br /><sub><b>Kihron</b></sub></a><br /><a href="https://github.com/CodeEditApp/CodeEdit/issues?q=author%3AKihron" title="Bug reports">πŸ›</a></td>
194195
</tr>
195196
</tbody>
196197
</table>

0 commit comments

Comments
Β (0)