Skip to content
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
26 changes: 9 additions & 17 deletions CodeEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
6C81916B29B41DD300B75C92 /* DequeModule in Frameworks */ = {isa = PBXBuildFile; productRef = 6C81916A29B41DD300B75C92 /* DequeModule */; };
6C85BB402C2105ED00EB5DEF /* CodeEditKit in Frameworks */ = {isa = PBXBuildFile; productRef = 6C85BB3F2C2105ED00EB5DEF /* CodeEditKit */; };
6C85BB442C210EFD00EB5DEF /* SwiftUIIntrospect in Frameworks */ = {isa = PBXBuildFile; productRef = 6C85BB432C210EFD00EB5DEF /* SwiftUIIntrospect */; };
6C9DB9E42D55656300ACD86E /* CodeEditSourceEditor in Frameworks */ = {isa = PBXBuildFile; productRef = 6C9DB9E32D55656300ACD86E /* CodeEditSourceEditor */; };
6CAAF68A29BC9C2300A1F48A /* (null) in Sources */ = {isa = PBXBuildFile; };
6CAAF69229BCC71C00A1F48A /* (null) in Sources */ = {isa = PBXBuildFile; };
6CAAF69429BCD78600A1F48A /* (null) in Sources */ = {isa = PBXBuildFile; };
Expand Down Expand Up @@ -185,7 +184,6 @@
6C0824A12C5C0C9700A0751E /* SwiftTerm in Frameworks */,
6C81916B29B41DD300B75C92 /* DequeModule in Frameworks */,
6CB94D032CA1205100E8651C /* AsyncAlgorithms in Frameworks */,
6C9DB9E42D55656300ACD86E /* CodeEditSourceEditor in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -319,7 +317,6 @@
6CB94D022CA1205100E8651C /* AsyncAlgorithms */,
6CC00A8A2CBEF150004E8134 /* CodeEditSourceEditor */,
6C73A6D22D4F1E550012D95C /* CodeEditSourceEditor */,
6C9DB9E32D55656300ACD86E /* CodeEditSourceEditor */,
);
productName = CodeEdit;
productReference = B658FB2C27DA9E0F00EA4DBD /* CodeEdit.app */;
Expand Down Expand Up @@ -422,7 +419,7 @@
303E88462C276FD600EEA8D9 /* XCRemoteSwiftPackageReference "LanguageServerProtocol" */,
6C4E37FA2C73E00700AEE7B5 /* XCRemoteSwiftPackageReference "SwiftTerm" */,
6CB94D012CA1205100E8651C /* XCRemoteSwiftPackageReference "swift-async-algorithms" */,
6C9DB9E22D55656300ACD86E /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */,
30597BCA2D9AA5BE004BC2CC /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */,
);
preferredProjectObjectVersion = 55;
productRefGroup = B658FB2D27DA9E0F00EA4DBD /* Products */;
Expand Down Expand Up @@ -1652,6 +1649,14 @@
minimumVersion = 0.13.2;
};
};
30597BCA2D9AA5BE004BC2CC /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/CodeEditApp/CodeEditSourceEditor.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.10.0;
};
};
30CB648F2C16CA8100CC8A9E /* XCRemoteSwiftPackageReference "LanguageServerProtocol" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/ChimeHQ/LanguageServerProtocol";
Expand Down Expand Up @@ -1740,14 +1745,6 @@
minimumVersion = 1.2.0;
};
};
6C9DB9E22D55656300ACD86E /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/CodeEditApp/CodeEditSourceEditor";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.10.0;
};
};
6CB94D012CA1205100E8651C /* XCRemoteSwiftPackageReference "swift-async-algorithms" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/apple/swift-async-algorithms.git";
Expand Down Expand Up @@ -1841,11 +1838,6 @@
package = 6C85BB422C210EFD00EB5DEF /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */;
productName = SwiftUIIntrospect;
};
6C9DB9E32D55656300ACD86E /* CodeEditSourceEditor */ = {
isa = XCSwiftPackageProductDependency;
package = 6C9DB9E22D55656300ACD86E /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */;
productName = CodeEditSourceEditor;
};
6CB4463F2B6DFF3A00539ED0 /* CodeEditSourceEditor */ = {
isa = XCSwiftPackageProductDependency;
productName = CodeEditSourceEditor;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions CodeEdit/Features/Editor/Views/CodeFileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ struct CodeFileView: View {
var lineHeightMultiple
@AppSettings(\.textEditing.wrapLinesToEditorWidth)
var wrapLinesToEditorWidth
@AppSettings(\.textEditing.overscroll)
var overscroll
@AppSettings(\.textEditing.font)
var settingsFont
@AppSettings(\.theme.useThemeBackground)
Expand Down Expand Up @@ -127,6 +129,7 @@ struct CodeFileView: View {
indentOption: (codeFile.indentOption ?? indentOption).textViewOption(),
lineHeight: lineHeightMultiple,
wrapLines: codeFile.wrapLines ?? wrapLinesToEditorWidth,
editorOverscroll: overscroll.overscrollPercentage,
cursorPositions: $cursorPositions,
useThemeBackground: useThemeBackground,
contentInsets: edgeInsets.nsEdgeInsets,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ extension SettingsData {
struct TextEditingSettings: Codable, Hashable, SearchableSettingsPage {

var searchKeys: [String] {
[
var keys = [
"Prefer Indent Using",
"Tab Width",
"Wrap lines to editor width",
"Editor Overscroll",
"Font",
"Font Size",
"Font Weight",
Expand All @@ -27,7 +28,10 @@ extension SettingsData {
"Enable type-over completion",
"Bracket Pair Highlight"
]
.map { NSLocalizedString($0, comment: "") }
if #available(macOS 14.0, *) {
keys.append("System Cursor")
}
return keys.map { NSLocalizedString($0, comment: "") }
}

/// An integer indicating how many spaces a `tab` will appear as visually.
Expand All @@ -49,6 +53,9 @@ extension SettingsData {
/// A flag indicating whether to wrap lines to editor width
var wrapLinesToEditorWidth: Bool = true

/// The percentage of overscroll to apply to the text view
var overscroll: OverscrollOption = .medium

/// A multiplier for setting the line height. Defaults to `1.2`
var lineHeightMultiple: Double = 1.2

Expand Down Expand Up @@ -88,6 +95,10 @@ extension SettingsData {
Bool.self,
forKey: .wrapLinesToEditorWidth
) ?? true
self.overscroll = try container.decodeIfPresent(
OverscrollOption.self,
forKey: .overscroll
) ?? .medium
self.lineHeightMultiple = try container.decodeIfPresent(
Double.self,
forKey: .lineHeightMultiple
Expand Down Expand Up @@ -167,6 +178,22 @@ extension SettingsData {
case underline
}
}

enum OverscrollOption: String, Codable {
case none
case small
case medium
case large

var overscrollPercentage: CGFloat {
switch self {
case .none: return 0
case .small: return 0.25
case .medium: return 0.5
case .large: return 0.75
}
}
}
}

struct EditorFont: Codable, Hashable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct TextEditingSettingsView: View {
defaultTabWidth
wrapLinesToEditorWidth
useSystemCursor
overscroll
}
Section {
fontSelector
Expand Down Expand Up @@ -80,6 +81,31 @@ private extension TextEditingSettingsView {
}
}

@ViewBuilder private var overscroll: some View {
Group {
Picker(
"Editor Overscroll",
selection: $textEditing.overscroll
) {
Text("None")
.tag(SettingsData.TextEditingSettings.OverscrollOption.none)
Divider()
Text("Small")
.tag(
SettingsData.TextEditingSettings.OverscrollOption.small
)
Text("Medium")
.tag(
SettingsData.TextEditingSettings.OverscrollOption.medium
)
Text("Large")
.tag(
SettingsData.TextEditingSettings.OverscrollOption.large
)
}
}
}

@ViewBuilder private var lineHeight: some View {
Stepper(
"Line Height",
Expand Down