Skip to content

Commit b4230c9

Browse files
Improved vertical line alignment (#180)
### Description Currently the line is misaligned, this change makes line content centered aligned vertically. **Note:** In order to fix this, I am adding `2` to the baseline offset. I cannot find why it is off by `2` in the first place. I'd like to not use a magic number, but unless another solution can be found, this will do for the time being. I played with font size and line height values and it remains centered, so it is truly off by `2`. ### 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 Before <img width="224" alt="image" src="https://user-images.githubusercontent.com/806104/234171466-166ef338-dc0a-4aea-a0ee-56d399dfcee1.png"> After <img width="223" alt="image" src="https://user-images.githubusercontent.com/806104/234171309-4269b1d9-4e5a-437d-99ea-170d6c3cbcef.png">
1 parent dba645d commit b4230c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/CodeEditTextView/Controller/STTextViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public class STTextViewController: NSViewController, STTextViewDelegate, ThemeAt
331331

332332
/// Calculated baseline offset depending on `lineHeight`.
333333
internal var baselineOffset: Double {
334-
((self.lineHeight) - font.lineHeight) / 2
334+
((self.lineHeight) - font.lineHeight) / 2 + 2
335335
}
336336

337337
// MARK: Selectors

0 commit comments

Comments
 (0)