CodeEditApp / CodeEditSourceEditor

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

🐞 Line height decreases when no characters exist on line #20

Closed 0xWDG closed 11 months ago

0xWDG commented 2 years ago

Description

The line height decreases if no characters exist on the line.

Related issues

ben-p-commits commented 1 year ago

@austincondiff , i'll take this one, I'm having fun poking at CETV lately :)

lukepistrol commented 1 year ago

@ben-p-commits assigned it to you

ben-p-commits commented 1 year ago

After doing some digging, I do see a code path for handling the empty text container case when laying out the STLineNumberRulerView in STTextView

image

I'm not seeing this bug in the sample app embedded in the dependency... a good sign we can fix this on our end.

ben-p-commits commented 1 year ago

Also confirmed that pulling in the latest main branch work on STTextView doesn't address this.

ben-p-commits commented 1 year ago

@krzyzanowskim - do you have any thoughts on how our usage of STTextView could be causing this?

I'm stumped. Not sure how our code is influencing this...

austincondiff commented 1 year ago

@ben-p-commits I believe the problem was caused when I decreased the font size of the line numbers. Because there is no text, the line collapses on the tallest item which is the smaller line number after removing the last character of the larger code. We may need a minimum height on each line or set the line height of the line number to be equal to the line height of the code.

luah5 commented 1 year ago

a slight edit to #170 could fix this issue.

austincondiff commented 1 year ago

@luah5 Did you want to take this one then?

luah5 commented 1 year ago

@luah5 Did you want to take this one then?

i've barely looked into this but i'll take it, also CETV needs to be updated.

luah5 commented 1 year ago

This might have something to do with @Eliulm's message where he pointed out that the line height overlaps a bit.

thecoolwinter commented 11 months ago

This has been resolved with #211.

https://github.com/CodeEditApp/CodeEditTextView/assets/35942988/10f8b973-ae81-4cdb-82bc-2337ee9e1176