File tree Expand file tree Collapse file tree 5 files changed +47
-10
lines changed
project.xcworkspace/xcshareddata/swiftpm
Settings/Pages/TextEditingSettings Expand file tree Collapse file tree 5 files changed +47
-10
lines changed Original file line number Diff line number Diff line change 16221622 repositoryURL = "https://github.com/CodeEditApp/CodeEditSymbols";
16231623 requirement = {
16241624 kind = exactVersion;
1625- version = 0.2.2 ;
1625+ version = 0.2.3 ;
16261626 };
16271627 };
16281628 287136B1292A407E00E9F5F4 /* XCRemoteSwiftPackageReference "SwiftLintPlugin" */ = {
17491749 isa = XCRemoteSwiftPackageReference;
17501750 repositoryURL = "https://github.com/CodeEditApp/CodeEditSourceEditor";
17511751 requirement = {
1752- kind = upToNextMajorVersion ;
1753- minimumVersion = 0.12.0 ;
1752+ kind = exactVersion ;
1753+ version = 0.13.1 ;
17541754 };
17551755 };
17561756/* End XCRemoteSwiftPackageReference section */
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ struct CodeFileView: View {
5050 var useSystemCursor
5151 @AppSettings ( \. textEditing. showMinimap)
5252 var showMinimap
53+ @AppSettings ( \. textEditing. reformatAtColumn)
54+ var reformatAtColumn
55+ @AppSettings ( \. textEditing. showReformattingGuide)
56+ var showReformattingGuide
5357
5458 @Environment ( \. colorScheme)
5559 private var colorScheme
@@ -135,7 +139,9 @@ struct CodeFileView: View {
135139 useSystemCursor: useSystemCursor,
136140 undoManager: undoManager,
137141 coordinators: textViewCoordinators,
138- showMinimap: showMinimap
142+ showMinimap: showMinimap,
143+ reformatAtColumn: reformatAtColumn,
144+ showReformattingGuide: showReformattingGuide
139145 )
140146 . id ( codeFile. fileURL)
141147 . background {
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ extension SettingsData {
2929 " Bracket Pair Emphasis " ,
3030 " Bracket Pair Highlight " ,
3131 " Show Minimap " ,
32+ " Reformat at Column " ,
33+ " Show Reformatting Guide " ,
3234 ]
3335 if #available( macOS 14 . 0 , * ) {
3436 keys. append ( " System Cursor " )
@@ -74,6 +76,12 @@ extension SettingsData {
7476 /// Toggle the minimap in the editor.
7577 var showMinimap : Bool = true
7678
79+ /// The column at which to reformat text
80+ var reformatAtColumn : Int = 80
81+
82+ /// Show the reformatting guide in the editor
83+ var showReformattingGuide : Bool = false
84+
7785 /// Default initializer
7886 init ( ) {
7987 self . populateCommands ( )
@@ -123,6 +131,11 @@ extension SettingsData {
123131 }
124132
125133 self . showMinimap = try container. decodeIfPresent ( Bool . self, forKey: . showMinimap) ?? true
134+ self . reformatAtColumn = try container. decodeIfPresent ( Int . self, forKey: . reformatAtColumn) ?? 80
135+ self . showReformattingGuide = try container. decodeIfPresent (
136+ Bool . self,
137+ forKey: . showReformattingGuide
138+ ) ?? false
126139
127140 self . populateCommands ( )
128141 }
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ struct TextEditingSettingsView: View {
2121 useSystemCursor
2222 overscroll
2323 showMinimap
24+ reformatSettings
2425 }
2526 Section {
2627 fontSelector
@@ -206,4 +207,21 @@ private extension TextEditingSettingsView {
206207 // swiftlint:disable:next line_length
207208 . help ( " The minimap gives you a high-level summary of your source code, with controls to quickly navigate your document. " )
208209 }
210+
211+ @ViewBuilder private var reformatSettings : some View {
212+ Stepper (
213+ " Reformat at Column " ,
214+ value: Binding < Double > (
215+ get: { Double ( textEditing. reformatAtColumn) } ,
216+ set: { textEditing. reformatAtColumn = Int ( $0) }
217+ ) ,
218+ in: 40 ... 200 ,
219+ step: 1 ,
220+ format: . number
221+ )
222+ . help ( " The column at which text should be reformatted " )
223+
224+ Toggle ( " Show Reformatting Guide " , isOn: $textEditing. showReformattingGuide)
225+ . help ( " Shows a vertical guide at the reformat column " )
226+ }
209227}
You can’t perform that action at this time.
0 commit comments