Skip to content

Commit 4ff2df5

Browse files
authored
Make ruler look more like Xcode. (#163)
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will be closed until separated. --> ### Description 1. Add 20 pixels of inset to the left of the ruler and 8 pixels of inset to the right of the ruler. I tried to match it as close as possible to Xcode. 2. Set the background color of the highlight ruler line to the same color as the highlighted line in the textView. ### Related Issues <!--- REQUIRED: Tag all related issues (e.g. * #123) --> <!--- If this PR resolves the issue please specify (e.g. * closes #123) --> <!--- If this PR addresses multiple issues, these issues must be related to one other --> * closes #156 * closes #128 ### Checklist <!--- Add things that are not yet implemented above --> - [x] I read and understood the [contributing guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md) as well as the [code of conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md) - [x] The issues this PR addresses are related to each other - [x] My changes generate no new warnings - [x] My code builds and runs on my machine - [x] My changes are all related to the related issue above - [x] I documented my code ### Screenshots <!--- REQUIRED: if issue is UI related --> <img width="765" alt="Screenshot 2023-03-16 at 19 05 59" src="https://user-images.githubusercontent.com/82230675/225717006-40530a7b-7864-404b-8d14-5307f6f83bdb.png"> <!--- IMPORTANT: Fill out all required fields. Otherwise we might close this PR temporarily -->
1 parent 3cac72e commit 4ff2df5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/CodeEditTextView/Controller/STTextViewController.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,12 @@ public class STTextViewController: NSViewController, STTextViewDelegate, ThemeAt
131131
rulerView.drawSeparator = false
132132
rulerView.baselineOffset = baselineOffset
133133
rulerView.font = NSFont.monospacedDigitSystemFont(ofSize: 9.5, weight: .regular)
134+
rulerView.selectedLineHighlightColor = theme.lineHighlight
135+
rulerView.rulerInsets = STRulerInsets(leading: 20, trailing: 8)
134136

135137
if self.isEditable == false {
136138
rulerView.selectedLineTextColor = nil
139+
rulerView.selectedLineHighlightColor = theme.background
137140
}
138141

139142
scrollView.verticalRulerView = rulerView
@@ -249,6 +252,7 @@ public class STTextViewController: NSViewController, STTextViewDelegate, ThemeAt
249252

250253
rulerView?.backgroundColor = useThemeBackground ? theme.background : .clear
251254
rulerView?.separatorColor = theme.invisibles
255+
rulerView?.selectedLineHighlightColor = theme.lineHighlight
252256
rulerView?.baselineOffset = baselineOffset
253257
rulerView.highlightSelectedLine = isEditable
254258

0 commit comments

Comments
 (0)