Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions CodeEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,7 @@
repositoryURL = "https://github.com/CodeEditApp/CodeEditSymbols";
requirement = {
kind = exactVersion;
version = 0.2.2;
version = 0.2.3;
};
};
287136B1292A407E00E9F5F4 /* XCRemoteSwiftPackageReference "SwiftLintPlugin" */ = {
Expand Down Expand Up @@ -1749,8 +1749,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/CodeEditApp/CodeEditSourceEditor";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.12.0;
kind = exactVersion;
version = 0.13.0;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down

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

8 changes: 7 additions & 1 deletion CodeEdit/Features/Editor/Views/CodeFileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ struct CodeFileView: View {
var useSystemCursor
@AppSettings(\.textEditing.showMinimap)
var showMinimap
@AppSettings(\.textEditing.reformatAtColumn)
var reformatAtColumn
@AppSettings(\.textEditing.showReformattingGuide)
var showReformattingGuide

@Environment(\.colorScheme)
private var colorScheme
Expand Down Expand Up @@ -135,7 +139,9 @@ struct CodeFileView: View {
useSystemCursor: useSystemCursor,
undoManager: undoManager,
coordinators: textViewCoordinators,
showMinimap: showMinimap
showMinimap: showMinimap,
reformatAtColumn: reformatAtColumn,
showReformattingGuide: showReformattingGuide
)
.id(codeFile.fileURL)
.background {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ extension SettingsData {
"Bracket Pair Emphasis",
"Bracket Pair Highlight",
"Show Minimap",
"Reformat at Column",
"Show Reformatting Guide",
]
if #available(macOS 14.0, *) {
keys.append("System Cursor")
Expand Down Expand Up @@ -74,6 +76,12 @@ extension SettingsData {
/// Toggle the minimap in the editor.
var showMinimap: Bool = true

/// The column at which to reformat text
var reformatAtColumn: Int = 80

/// Show the reformatting guide in the editor
var showReformattingGuide: Bool = false

/// Default initializer
init() {
self.populateCommands()
Expand Down Expand Up @@ -123,6 +131,11 @@ extension SettingsData {
}

self.showMinimap = try container.decodeIfPresent(Bool.self, forKey: .showMinimap) ?? true
self.reformatAtColumn = try container.decodeIfPresent(Int.self, forKey: .reformatAtColumn) ?? 80
self.showReformattingGuide = try container.decodeIfPresent(
Bool.self,
forKey: .showReformattingGuide
) ?? false

self.populateCommands()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct TextEditingSettingsView: View {
useSystemCursor
overscroll
showMinimap
reformatSettings
}
Section {
fontSelector
Expand Down Expand Up @@ -206,4 +207,21 @@ private extension TextEditingSettingsView {
// swiftlint:disable:next line_length
.help("The minimap gives you a high-level summary of your source code, with controls to quickly navigate your document.")
}

@ViewBuilder private var reformatSettings: some View {
Stepper(
"Reformat at Column",
value: Binding<Double>(
get: { Double(textEditing.reformatAtColumn) },
set: { textEditing.reformatAtColumn = Int($0) }
),
in: 40...200,
step: 1,
format: .number
)
.help("The column at which text should be reformatted")

Toggle("Show Reformatting Guide", isOn: $textEditing.showReformattingGuide)
.help("Shows a vertical guide at the reformat column")
}
}
Loading