@@ -20,6 +20,8 @@ public struct CodeEditTextView: NSViewControllerRepresentable {
2020 /// - font: The default font
2121 /// - tabWidth: The tab width
2222 /// - lineHeight: The line height multiplier (e.g. `1.2`)
23+ /// - wrapLines: Whether lines wrap to the width of the editor
24+ /// - wrappedIndent: The number of spaces to indent wrapped lines
2325 /// - editorOverscroll: The percentage for overscroll, between 0-1 (default: `0.0`)
2426 public init (
2527 _ text: Binding < String > ,
@@ -28,6 +30,8 @@ public struct CodeEditTextView: NSViewControllerRepresentable {
2830 font: Binding < NSFont > ,
2931 tabWidth: Binding < Int > ,
3032 lineHeight: Binding < Double > ,
33+ wrapLines: Binding < Bool > ,
34+ wrappedIndent: Binding < Int > ,
3135 editorOverscroll: Binding < Double > = . constant( 0.0 ) ,
3236 cursorPosition: Published < ( Int , Int ) > . Publisher ? = nil
3337 ) {
@@ -37,6 +41,8 @@ public struct CodeEditTextView: NSViewControllerRepresentable {
3741 self . _font = font
3842 self . _tabWidth = tabWidth
3943 self . _lineHeight = lineHeight
44+ self . _wrapLines = wrapLines
45+ self . _wrappedIndent = wrappedIndent
4046 self . _editorOverscroll = editorOverscroll
4147 self . cursorPosition = cursorPosition
4248 }
@@ -47,6 +53,8 @@ public struct CodeEditTextView: NSViewControllerRepresentable {
4753 @Binding private var font : NSFont
4854 @Binding private var tabWidth : Int
4955 @Binding private var lineHeight : Double
56+ @Binding private var wrapLines : Bool
57+ @Binding private var wrappedIndent : Int
5058 @Binding private var editorOverscroll : Double
5159 private var cursorPosition : Published < ( Int , Int ) > . Publisher ?
5260
@@ -59,6 +67,8 @@ public struct CodeEditTextView: NSViewControllerRepresentable {
5967 font: font,
6068 theme: theme,
6169 tabWidth: tabWidth,
70+ wrapLines: wrapLines,
71+ wrappedIndent: wrappedIndent,
6272 cursorPosition: cursorPosition,
6373 editorOverscroll: editorOverscroll
6474 )
@@ -71,6 +81,8 @@ public struct CodeEditTextView: NSViewControllerRepresentable {
7181 controller. language = language
7282 controller. theme = theme
7383 controller. tabWidth = tabWidth
84+ controller. wrapLines = wrapLines
85+ controller. wrappedIndent = wrappedIndent
7486 controller. lineHeightMultiple = lineHeight
7587 controller. editorOverscroll = editorOverscroll
7688 controller. reloadUI ( )
0 commit comments