Skip to content

Commit add1c51

Browse files
yusufozgullukepistrol
authored andcommitted
Rename variables
1 parent 238b7b4 commit add1c51

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct ContentView: View {
4444
@State var font = NSFont.monospacedSystemFont(ofSize: 11, weight: .regular)
4545
@State var tabWidth = 4
4646
@State var lineHeight = 1.2
47-
@State var overScrollRatio = 0.3
47+
@State var editorOverscroll = 0.3
4848

4949
var body: some View {
5050
CodeEditTextView(
@@ -54,7 +54,7 @@ struct ContentView: View {
5454
font: $font,
5555
tabWidth: $tabWidth,
5656
lineHeight: $lineHeight,
57-
overScrollRatio: $overScrollRatio
57+
editorOverscroll: $editorOverscroll
5858
)
5959
}
6060
}

Sources/CodeEditTextView/CodeEditTextView.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ 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-
/// - overScrollRatio: The ratio for overscroll, between 0-1 (default: `0.0`)
23+
/// - editorOverscroll: The percentage for overscroll, between 0-1 (default: `0.0`)
2424
public init(
2525
_ text: Binding<String>,
2626
language: CodeLanguage,
2727
theme: Binding<EditorTheme>,
2828
font: Binding<NSFont>,
2929
tabWidth: Binding<Int>,
3030
lineHeight: Binding<Double>,
31-
overScrollRatio: Binding<Double> = .constant(0.0),
31+
editorOverscroll: Binding<Double> = .constant(0.0),
3232
cursorPosition: Published<(Int, Int)>.Publisher? = nil
3333
) {
3434
self._text = text
@@ -37,7 +37,7 @@ public struct CodeEditTextView: NSViewControllerRepresentable {
3737
self._font = font
3838
self._tabWidth = tabWidth
3939
self._lineHeight = lineHeight
40-
self._overScrollRatio = overScrollRatio
40+
self._editorOverscroll = editorOverscroll
4141
self.cursorPosition = cursorPosition
4242
}
4343

@@ -47,7 +47,7 @@ public struct CodeEditTextView: NSViewControllerRepresentable {
4747
@Binding private var font: NSFont
4848
@Binding private var tabWidth: Int
4949
@Binding private var lineHeight: Double
50-
@Binding private var overScrollRatio: Double
50+
@Binding private var editorOverscroll: Double
5151
private var cursorPosition: Published<(Int, Int)>.Publisher?
5252

5353
public typealias NSViewControllerType = STTextViewController
@@ -60,7 +60,7 @@ public struct CodeEditTextView: NSViewControllerRepresentable {
6060
theme: theme,
6161
tabWidth: tabWidth,
6262
cursorPosition: cursorPosition,
63-
overScrollRatio: overScrollRatio
63+
editorOverscroll: editorOverscroll
6464
)
6565
controller.lineHeightMultiple = lineHeight
6666
return controller
@@ -72,7 +72,7 @@ public struct CodeEditTextView: NSViewControllerRepresentable {
7272
controller.theme = theme
7373
controller.tabWidth = tabWidth
7474
controller.lineHeightMultiple = lineHeight
75-
controller.overScrollRatio = overScrollRatio
75+
controller.editorOverscroll = editorOverscroll
7676
controller.reloadUI()
7777
return
7878
}

Sources/CodeEditTextView/Documentation.docc/CodeEditTextView.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct ContentView: View {
1212
@State var font = NSFont.monospacedSystemFont(ofSize: 11, weight: .regular)
1313
@State var tabWidth = 4
1414
@State var lineHeight = 1.2
15-
@State var overScrollRatio = 0.3
15+
@State var editorOverscroll = 0.3
1616

1717
var body: some View {
1818
CodeEditTextView(
@@ -22,7 +22,7 @@ struct ContentView: View {
2222
font: $font,
2323
tabWidth: $tabWidth,
2424
lineHeight: $lineHeight,
25-
overScrollRatio: $overScrollRatio
25+
editorOverscroll: $editorOverscroll
2626
)
2727
}
2828
}

Sources/CodeEditTextView/Documentation.docc/STTextViewController.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
- ``font``
1111
- ``tabWidth``
1212
- ``lineHeightMultiple``
13-
- ``overScrollRatio``
13+
- ``editorOverscroll``

Sources/CodeEditTextView/STTextViewController.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public class STTextViewController: NSViewController, STTextViewDelegate, ThemeAt
4242
/// The font to use in the `textView`
4343
public var font: NSFont
4444

45-
/// The overScrollRatio to use for the textView over scroll
46-
public var overScrollRatio: Double
45+
/// The editorOverscroll to use for the textView over scroll
46+
public var editorOverscroll: Double
4747

4848
// MARK: - Highlighting
4949

@@ -59,15 +59,15 @@ public class STTextViewController: NSViewController, STTextViewDelegate, ThemeAt
5959
theme: EditorTheme,
6060
tabWidth: Int,
6161
cursorPosition: Published<(Int, Int)>.Publisher? = nil,
62-
overScrollRatio: Double
62+
editorOverscroll: Double
6363
) {
6464
self.text = text
6565
self.language = language
6666
self.font = font
6767
self.theme = theme
6868
self.tabWidth = tabWidth
6969
self.cursorPosition = cursorPosition
70-
self.overScrollRatio = overScrollRatio
70+
self.editorOverscroll = editorOverscroll
7171
super.init(nibName: nil, bundle: nil)
7272
}
7373

@@ -184,7 +184,7 @@ public class STTextViewController: NSViewController, STTextViewDelegate, ThemeAt
184184
/// ScrollView's bottom inset using as editor overscroll
185185
private var bottomContentInsets: CGFloat {
186186
let height = view.frame.height
187-
var inset = overScrollRatio * height
187+
var inset = editorOverscroll * height
188188

189189
if height - inset < lineHeight {
190190
inset = height - lineHeight

Tests/CodeEditTextViewTests/STTextViewControllerTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class STTextViewControllerTests: XCTestCase {
3333
font: .monospacedSystemFont(ofSize: 11, weight: .medium),
3434
theme: theme,
3535
tabWidth: 4,
36-
overScrollRatio: 0.5
36+
editorOverscroll: 0.5
3737
)
3838
}
3939

@@ -68,27 +68,27 @@ final class STTextViewControllerTests: XCTestCase {
6868
width: 100,
6969
height: 100)
7070

71-
// overScrollRatio: 0
71+
// editorOverscroll: 0
7272
XCTAssertEqual(scrollView.contentView.contentInsets.bottom, 0)
7373

74-
controller.overScrollRatio = 0.5
74+
controller.editorOverscroll = 0.5
7575
controller.reloadUI()
7676

77-
// overScrollRatio: 0.5
77+
// editorOverscroll: 0.5
7878
XCTAssertEqual(scrollView.contentView.contentInsets.bottom, 50.0)
7979

80-
controller.overScrollRatio = 1.0
80+
controller.editorOverscroll = 1.0
8181
controller.reloadUI()
8282

83-
// overScrollRatio: 1.0
83+
// editorOverscroll: 1.0
8484
XCTAssertEqual(scrollView.contentView.contentInsets.bottom, 87.0)
8585
}
8686

8787
func test_editorOverScroll_ZeroCondition() throws {
8888
let scrollView = try XCTUnwrap(controller.view as? NSScrollView)
8989
scrollView.frame = .zero
9090

91-
// overScrollRatio: 0
91+
// editorOverscroll: 0
9292
XCTAssertEqual(scrollView.contentView.contentInsets.bottom, 0)
9393
}
9494
}

0 commit comments

Comments
 (0)