CodeEditApp / CodeEditSourceEditor

A code editor view written in Swift powered by tree-sitter.
https://codeeditapp.github.io/CodeEditSourceEditor/documentation/codeeditsourceeditor
MIT License
510 stars 78 forks source link

Add `contentInsets` Parameter #141

Closed thecoolwinter closed 1 year ago

thecoolwinter commented 1 year ago

Description

This PR adds a contentInsets parameter that lets users set an inset object for the editor. It also updates STTextView to be able to set the left inset correctly. When left nil the scroll view will use automatic insets.

This also doesn't override the overscroll option, but rather adds the overscroll after the insets are applied.

Related Issues

Screenshots

Adding top and left insets:

Screenshot 2023-02-14 at 3 09 57 PM

Adding left and bottom insets (scroller is also inset):

Screenshot 2023-02-14 at 3 10 15 PM
Wouter01 commented 1 year ago

I'll give it a go tomorrow, but looks good!

thecoolwinter commented 1 year ago

~Ah shoot, don't merge it looks like a test is still failing. I'll fix it in a bit.~

Ready to review, just added some tests and fixed to pass the failing ones.