Skip to content

fix 'Open Quickly' fatal error #1793

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

Merged
merged 5 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions CodeEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@
61A53A812B4449F00093BF8A /* WorkspaceDocument+Index.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61A53A802B4449F00093BF8A /* WorkspaceDocument+Index.swift */; };
661EF7B82BEE215300C3E577 /* ImageFileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 661EF7B72BEE215300C3E577 /* ImageFileView.swift */; };
661EF7BD2BEE215300C3E577 /* LoadingFileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 661EF7BC2BEE215300C3E577 /* LoadingFileView.swift */; };
669A50512C380C1800304CD8 /* String+escapedWhiteSpaces.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669A50502C380C1800304CD8 /* String+escapedWhiteSpaces.swift */; };
669A50532C380C8E00304CD8 /* Collection+subscript_safe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669A50522C380C8E00304CD8 /* Collection+subscript_safe.swift */; };
664935422C35A5BC00461C35 /* NSTableViewWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 664935412C35A5BC00461C35 /* NSTableViewWrapper.swift */; };
6653EE552C34817900B82DE2 /* QuickSearchResultLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6653EE542C34817900B82DE2 /* QuickSearchResultLabel.swift */; };
669BC4082BED306400D1197C /* AnyFileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669BC4072BED306400D1197C /* AnyFileView.swift */; };
Expand Down Expand Up @@ -946,6 +948,8 @@
661EF7BC2BEE215300C3E577 /* LoadingFileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingFileView.swift; sourceTree = "<group>"; };
664935412C35A5BC00461C35 /* NSTableViewWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSTableViewWrapper.swift; sourceTree = "<group>"; };
6653EE542C34817900B82DE2 /* QuickSearchResultLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickSearchResultLabel.swift; sourceTree = "<group>"; };
669A50502C380C1800304CD8 /* String+escapedWhiteSpaces.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+escapedWhiteSpaces.swift"; sourceTree = "<group>"; };
669A50522C380C8E00304CD8 /* Collection+subscript_safe.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Collection+subscript_safe.swift"; sourceTree = "<group>"; };
669BC4072BED306400D1197C /* AnyFileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyFileView.swift; sourceTree = "<group>"; };
66AF6CE12BF17CC300D83C9D /* StatusBarViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusBarViewModel.swift; sourceTree = "<group>"; };
66AF6CE32BF17F6800D83C9D /* StatusBarFileInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusBarFileInfoView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2339,6 +2343,7 @@
58D01C87293167DC00C5B6B4 /* Extensions */ = {
isa = PBXGroup;
children = (
669A504F2C380BFD00304CD8 /* Collection */,
6C82D6C429C0129E00495C54 /* NSApplication */,
77A01E922BCA9C0400F0EA38 /* NSWindow */,
588847672992AAB800996D95 /* Array */,
Expand All @@ -2363,6 +2368,7 @@
58D01C8D293167DC00C5B6B4 /* String+RemoveOccurrences.swift */,
58D01C8C293167DC00C5B6B4 /* String+SHA256.swift */,
85745D622A38F8D900089AAB /* String+HighlightOccurrences.swift */,
669A50502C380C1800304CD8 /* String+escapedWhiteSpaces.swift */,
);
path = String;
sourceTree = "<group>";
Expand Down Expand Up @@ -2546,6 +2552,14 @@
path = Views;
sourceTree = "<group>";
};
669A504F2C380BFD00304CD8 /* Collection */ = {
isa = PBXGroup;
children = (
669A50522C380C8E00304CD8 /* Collection+subscript_safe.swift */,
);
path = Collection;
sourceTree = "<group>";
};
66AF6CE02BF17CB100D83C9D /* ViewModels */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3952,6 +3966,7 @@
B65B10F52B081A0C002852CF /* SourceControlAddRemoteView.swift in Sources */,
58D01C99293167DC00C5B6B4 /* String+MD5.swift in Sources */,
20EBB505280C329800F3A5DA /* CommitListItemView.swift in Sources */,
669A50512C380C1800304CD8 /* String+escapedWhiteSpaces.swift in Sources */,
5878DAB2291D627C00DD95A3 /* EditorPathBarView.swift in Sources */,
664935422C35A5BC00461C35 /* NSTableViewWrapper.swift in Sources */,
04BC1CDE2AD9B4B000A83EA5 /* EditorFileTabCloseButton.swift in Sources */,
Expand Down Expand Up @@ -3994,6 +4009,7 @@
587B9E8129301D8F00AC7927 /* PublicKey.swift in Sources */,
611191FE2B08CCD200D4459B /* SearchIndexer+File.swift in Sources */,
77A01E302BB4270F00F0EA38 /* ProjectCEWorkspaceSettingsView.swift in Sources */,
669A50532C380C8E00304CD8 /* Collection+subscript_safe.swift in Sources */,
77A01E2C2BB425B200F0EA38 /* CEWorkspaceSettingsData+TasksSettings.swift in Sources */,
5B241BF32B6DDBFF0016E616 /* IgnorePatternListItemView.swift in Sources */,
6CB52DC92AC8DC3E002E75B3 /* CEWorkspaceFileManager+FileManagement.swift in Sources */,
Expand Down
13 changes: 0 additions & 13 deletions CodeEdit/Features/Git/Client/GitClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,3 @@ class GitClient {
return output
}
}

internal extension Collection {
/// Returns the element at the specified index if it is within bounds, otherwise nil.
subscript (safe index: Index) -> Element? {
indices.contains(index) ? self[index] : nil
}
}

internal extension String {
func escapedWhiteSpaces() -> String {
self.replacingOccurrences(of: " ", with: "\\ ")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ struct NSTableViewWrapper<Content: View, Item: Identifiable & Hashable>: NSViewR

func tableViewSelectionDidChange(_ notification: Notification) {
if let view = notification.object as? NSTableView {
let newSelection = parent.data[view.selectedRow]
let newSelection = parent.data[safe: view.selectedRow]
if newSelection != parent.selection {
parent.selection = newSelection
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// Collection+subscript_safe.swift
// CodeEdit
//
// Created by Paul Ebose on 2024/07/05.
//

import Foundation

extension Collection {
/// Returns the element at the specified index if it is within bounds, otherwise nil.
subscript (safe index: Index) -> Element? {
indices.contains(index) ? self[index] : nil
}
}
14 changes: 14 additions & 0 deletions CodeEdit/Utils/Extensions/String/String+escapedWhiteSpaces.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// String+escapedWhiteSpaces.swift
// CodeEdit
//
// Created by Paul Ebose on 2024/07/05.
//

import Foundation

extension String {
func escapedWhiteSpaces() -> String {
self.replacingOccurrences(of: " ", with: "\\ ")
}
}
Loading