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

Update To New Text View #1509

Merged
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
34 changes: 17 additions & 17 deletions CodeEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@
615AA21A2B0CFD480013FCCC /* LazyStringLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 615AA2192B0CFD480013FCCC /* LazyStringLoader.swift */; };
6C049A372A49E2DB00D42923 /* DirectoryEventStream.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C049A362A49E2DB00D42923 /* DirectoryEventStream.swift */; };
6C05A8AF284D0CA3007F4EAA /* WorkspaceDocument+Listeners.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C05A8AE284D0CA3007F4EAA /* WorkspaceDocument+Listeners.swift */; };
6C092EC62A4E803300489202 /* CodeEditTextView in Frameworks */ = {isa = PBXBuildFile; productRef = 6C092EC52A4E803300489202 /* CodeEditTextView */; };
6C092EDA2A53A58600489202 /* EditorLayout+StateRestoration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C092ED92A53A58600489202 /* EditorLayout+StateRestoration.swift */; };
6C092EE02A53BFCF00489202 /* WorkspaceStateKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C092EDF2A53BFCF00489202 /* WorkspaceStateKey.swift */; };
6C0D0C6829E861B000AE4D3F /* SettingsSidebarFix.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C0D0C6729E861B000AE4D3F /* SettingsSidebarFix.swift */; };
Expand Down Expand Up @@ -352,6 +351,7 @@
6CE622692A2A174A0013085C /* InspectorTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CE622682A2A174A0013085C /* InspectorTab.swift */; };
6CE6226B2A2A1C730013085C /* UtilityAreaTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CE6226A2A2A1C730013085C /* UtilityAreaTab.swift */; };
6CE6226E2A2A1CDE0013085C /* NavigatorTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CE6226D2A2A1CDE0013085C /* NavigatorTab.swift */; };
6CE952E32B29433500C29C31 /* CodeEditSourceEditor in Frameworks */ = {isa = PBXBuildFile; productRef = 6CE952E22B29433500C29C31 /* CodeEditSourceEditor */; };
6CED16E42A3E660D000EC962 /* String+Lines.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CED16E32A3E660D000EC962 /* String+Lines.swift */; };
6CFF967429BEBCC300182D6F /* FindCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CFF967329BEBCC300182D6F /* FindCommands.swift */; };
6CFF967629BEBCD900182D6F /* FileCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CFF967529BEBCD900182D6F /* FileCommands.swift */; };
Expand Down Expand Up @@ -990,11 +990,11 @@
6C0F3A3C2A1D0D5000223D19 /* CodeEditKit in Frameworks */,
6C5BE5222A3D5666002DA0FC /* WindowManagement in Frameworks */,
6C66C31329D05CDC00DE9ED2 /* GRDB in Frameworks */,
6C092EC62A4E803300489202 /* CodeEditTextView in Frameworks */,
58F2EB1E292FB954004A9BDE /* Sparkle in Frameworks */,
6C2149412A1BB9AB00748382 /* LogStream in Frameworks */,
6C147C4529A329350089B630 /* OrderedCollections in Frameworks */,
6C6BD6F429CD142C00235D17 /* CollectionConcurrencyKit in Frameworks */,
6CE952E32B29433500C29C31 /* CodeEditSourceEditor in Frameworks */,
5879828A292ED15F0085B254 /* SwiftTerm in Frameworks */,
6CDEFC9629E22C2700B7C684 /* Introspect in Frameworks */,
2816F594280CF50500DD548B /* CodeEditSymbols in Frameworks */,
Expand Down Expand Up @@ -2851,7 +2851,7 @@
6CDEFC9529E22C2700B7C684 /* Introspect */,
6C0F3A3B2A1D0D5000223D19 /* CodeEditKit */,
6C5BE5212A3D5666002DA0FC /* WindowManagement */,
6C092EC52A4E803300489202 /* CodeEditTextView */,
6CE952E22B29433500C29C31 /* CodeEditSourceEditor */,
);
productName = CodeEdit;
productReference = B658FB2C27DA9E0F00EA4DBD /* CodeEdit.app */;
Expand Down Expand Up @@ -2947,7 +2947,7 @@
6CDEFC9429E22C2700B7C684 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */,
6C0F3A3A2A1D0D5000223D19 /* XCRemoteSwiftPackageReference "CodeEditKit" */,
6C5BE5202A3D5666002DA0FC /* XCRemoteSwiftPackageReference "SwiftUI-WindowManagement" */,
6C092EC42A4E803300489202 /* XCRemoteSwiftPackageReference "CodeEditTextView" */,
6CE952E12B29433500C29C31 /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */,
);
productRefGroup = B658FB2D27DA9E0F00EA4DBD /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -4397,14 +4397,6 @@
version = 2.3.0;
};
};
6C092EC42A4E803300489202 /* XCRemoteSwiftPackageReference "CodeEditTextView" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/CodeEditApp/CodeEditTextView";
requirement = {
kind = exactVersion;
version = 0.6.8;
};
};
6C0F3A3A2A1D0D5000223D19 /* XCRemoteSwiftPackageReference "CodeEditKit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/CodeEditApp/CodeEditKit";
Expand Down Expand Up @@ -4461,6 +4453,14 @@
minimumVersion = 0.2.3;
};
};
6CE952E12B29433500C29C31 /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/CodeEditApp/CodeEditSourceEditor.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.7.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand All @@ -4484,11 +4484,6 @@
package = 58F2EB1C292FB954004A9BDE /* XCRemoteSwiftPackageReference "Sparkle" */;
productName = Sparkle;
};
6C092EC52A4E803300489202 /* CodeEditTextView */ = {
isa = XCSwiftPackageProductDependency;
package = 6C092EC42A4E803300489202 /* XCRemoteSwiftPackageReference "CodeEditTextView" */;
productName = CodeEditTextView;
};
6C0F3A3B2A1D0D5000223D19 /* CodeEditKit */ = {
isa = XCSwiftPackageProductDependency;
package = 6C0F3A3A2A1D0D5000223D19 /* XCRemoteSwiftPackageReference "CodeEditKit" */;
Expand Down Expand Up @@ -4538,6 +4533,11 @@
package = 6CDEFC9429E22C2700B7C684 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */;
productName = Introspect;
};
6CE952E22B29433500C29C31 /* CodeEditSourceEditor */ = {
isa = XCSwiftPackageProductDependency;
package = 6CE952E12B29433500C29C31 /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */;
productName = CodeEditSourceEditor;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = B658FB2427DA9E0F00EA4DBD /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
"version" : "0.1.17"
}
},
{
"identity" : "codeeditsourceeditor",
"kind" : "remoteSourceControl",
"location" : "https://github.com/CodeEditApp/CodeEditSourceEditor.git",
"state" : {
"revision" : "e08a43ea07861e42d42f317899df69bf8f0a0a54",
"version" : "0.7.0"
}
},
{
"identity" : "codeeditsymbols",
"kind" : "remoteSourceControl",
Expand All @@ -39,10 +48,10 @@
{
"identity" : "codeedittextview",
"kind" : "remoteSourceControl",
"location" : "https://github.com/CodeEditApp/CodeEditTextView",
"location" : "https://github.com/CodeEditApp/CodeEditTextView.git",
"state" : {
"revision" : "6a04ca72975b25b28829e419a43cce5cabb97891",
"version" : "0.6.8"
"revision" : "c867fed329b2b4ce91a13742e20626f50cf233bb",
"version" : "0.7.0"
}
},
{
Expand Down Expand Up @@ -171,15 +180,6 @@
"version" : "2.3.0"
}
},
{
"identity" : "sttextview",
"kind" : "remoteSourceControl",
"location" : "https://github.com/krzyzanowskim/STTextView.git",
"state" : {
"revision" : "1046965bd62dc05cf17beb4b4e901cdae851395e",
"version" : "0.8.7"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -257,8 +257,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/ChimeHQ/TextFormation",
"state" : {
"revision" : "b4987856bc860643ac2c9cdbc7d5f3e9ade68377",
"version" : "0.8.1"
"revision" : "f6faed6abd768ae95b70d10113d4008a7cac57a7",
"version" : "0.8.2"
}
},
{
Expand Down
3 changes: 2 additions & 1 deletion CodeEdit/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import SwiftUI
import CodeEditSourceEditor
import CodeEditSymbols

final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
Expand Down Expand Up @@ -102,7 +103,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
return
}
if line > 0, let document = document as? CodeFileDocument {
document.cursorPosition = (line, column > 0 ? column : 1)
document.cursorPositions = [CursorPosition(line: line, column: column > 0 ? column : 1)]
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions CodeEdit/Features/CodeFile/CodeFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import SwiftUI
import UniformTypeIdentifiers
import QuickLookUI
import CodeEditTextView
import CodeEditSourceEditor
import CodeEditLanguages
import Combine

Expand Down Expand Up @@ -70,7 +70,7 @@ final class CodeFileDocument: NSDocument, ObservableObject, QLPreviewItem {
fileURL
}

@Published var cursorPosition = (1, 1)
@Published var cursorPositions = [CursorPosition]()
thecoolwinter marked this conversation as resolved.
Show resolved Hide resolved

private let isDocumentEditedSubject = PassthroughSubject<Bool, Never>()

Expand Down
5 changes: 3 additions & 2 deletions CodeEdit/Features/CodeFile/CodeFileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import SwiftUI
import CodeEditSourceEditor
import CodeEditTextView
thecoolwinter marked this conversation as resolved.
Show resolved Hide resolved
import CodeEditLanguages
import Combine
Expand Down Expand Up @@ -98,7 +99,7 @@ struct CodeFileView: View {
@EnvironmentObject private var editor: Editor

var body: some View {
CodeEditTextView(
CodeEditSourceEditor(
$codeFile.content,
language: getLanguage(),
theme: selectedTheme.editor.editorTheme,
Expand All @@ -107,7 +108,7 @@ struct CodeFileView: View {
indentOption: (codeFile.indentOption ?? indentOption).textViewOption(),
lineHeight: lineHeightMultiple,
wrapLines: codeFile.wrapLines ?? wrapLinesToEditorWidth,
cursorPosition: $codeFile.cursorPosition,
cursorPositions: $codeFile.cursorPositions,
useThemeBackground: useThemeBackground,
contentInsets: edgeInsets.nsEdgeInsets,
isEditable: isEditable,
Expand Down
4 changes: 2 additions & 2 deletions CodeEdit/Features/Git/SourceControlManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ final class SourceControlManager: ObservableObject {
do {
try await gitClient.discardChanges(for: file.url)
// TODO: Refresh content of active and unmodified document,
// requires CodeEditTextView changes
// requires CodeEditSourceEditor changes
} catch {
await showAlertForError(title: "Failed to discard changes", error: error)
}
Expand All @@ -234,7 +234,7 @@ final class SourceControlManager: ObservableObject {
do {
try await gitClient.discardAllChanges()
// TODO: Refresh content of active and unmodified document,
// requires CodeEditTextView changes
// requires CodeEditSourceEditor changes
} catch {
await showAlertForError(title: "Failed to discard changes", error: error)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import SwiftUI
import CodeEditTextView
import CodeEditSourceEditor

// swiftlint:disable file_length

Expand Down