Repository: CodeEditApp/CodeEdit
File: CodeEdit/Features/NavigatorArea/OutlineView/FileSystemTableViewCell.swift (Swift)

Code before:
    func addIcon(item: CEWorkspaceFile) {
        fileItem = item
        imageView?.image = item.nsIcon
        imageView?.contentTintColor = color(for: item)

        let fileName = item.labelFileName()

        // Apply bold style if the filename matches the workspace filter
        if let filter = workspace?.filter, !filter.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
            let attributedString = NSMutableAttributedString(string: fileName)

            // Check if the filename contains the filter text
            let range = NSString(string: fileName).range(of: filter, options: .caseInsensitive)
            if range.location != NSNotFound {
                // Set the label color to secondary
                attributedString.addAttribute(
                    .foregroundColor,
                    value: NSColor.secondaryLabelColor,
                    range: NSRange(location: 0, length: attributedString.length)
                )

                // If the filter text matches, bold the matching text and set primary label color
                attributedString.addAttributes(
                    [
                        .font: NSFont.boldSystemFont(ofSize: textField?.font?.pointSize ?? 12),
                        .foregroundColor: NSColor.textColor
                    ],
                    range: range
                )
            } else {
                // If no match, apply primary label color for parent folder,
                // or secondary label color for a non-matching file
                attributedString.addAttribute(
                    .foregroundColor,
                    value: item.isFolder ? NSColor.labelColor : NSColor.secondaryLabelColor,
                    range: NSRange(location: 0, length: attributedString.length)
                )
            }

            textField?.attributedStringValue = attributedString
        } else {
            // If no filter is applied, reset to normal font and primary label color
            textField?.attributedStringValue = NSAttributedString(
                string: fileName,
                attributes: [
                    .font: NSFont.systemFont(ofSize: textField?.font?.pointSize ?? 12),
                    .foregroundColor: NSColor.labelColor
                ]
            )
        }
    }

Review comment (bug):
```suggestion
.foregroundColor: NSColor.labelColor
```

Fixes this selection color bug:
![Screenshot 2024-10-06 at 12 51 29 PM](https://github.com/user-attachments/assets/37635ddd-4468-462c-a1b2-a87c80efe505)
![Screenshot 2024-10-06 at 12 51 38 PM](https://github.com/user-attachments/assets/f32e8742-2622-4259-a0ab-ab91b3c27293)


Code after:
        super.configLabel(label: label, isEditable: isEditable)
        label.delegate = self
    }

    func addIcon(item: CEWorkspaceFile) {
        fileItem = item
        imageView?.image = item.nsIcon
        imageView?.contentTintColor = color(for: item)

        let fileName = item.labelFileName()

        guard let navigatorFilter else {
            textField?.stringValue = fileName
            return
        }

        // Apply bold style if the filename matches the workspace filter
        if !navigatorFilter.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
            let attributedString = NSMutableAttributedString(string: fileName)

            // Check if the filename contains the filter text
            let range = NSString(string: fileName).range(of: navigatorFilter, options: .caseInsensitive)
            if range.location != NSNotFound {
                // Set the label color to secondary
                attributedString.addAttribute(
                    .foregroundColor,
                    value: NSColor.secondaryLabelColor,
                    range: NSRange(location: 0, length: attributedString.length)
                )

                // If the filter text matches, bold the matching text and set primary label color
                attributedString.addAttributes(
                    [
                        .font: NSFont.boldSystemFont(ofSize: textField?.font?.pointSize ?? 12),
.foregroundColor: NSColor.labelColor
                    ],
                    range: range
                )
            } else {
                // If no match, apply primary label color for parent folder,
                // or secondary label color for a non-matching file
                attributedString.addAttribute(
                    .foregroundColor,
                    value: item.isFolder ? NSColor.labelColor : NSColor.secondaryLabelColor,
                    range: NSRange(location: 0, length: attributedString.length)
                )
            }

            textField?.attributedStringValue = attributedString
        } else {
            // If no filter is applied, reset to normal font and primary label color