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

🐞 Editor lags while resizing #119

Closed Wouter01 closed 1 year ago

Wouter01 commented 1 year ago

Description

When resizing the editor, the whole app will lag quite a bit. I've had a look and the culprit seems to be the rulerview:

rulerView = STLineNumberRulerView(textView: textView, scrollView: scrollView)

When this is commented out, everything is (mostly) smooth.

Another thing I noticed is that if textView.widthTracksTextView is set to false, it's also smoother.

To Reproduce

  1. Open editor with file
  2. Resize the window

Expected behavior

Resize is smooth

Version information

CodeEdit: [e.g. 1.0] macOS: [e.g. 13.1] Xcode: [e.g. 14.2]

Additional context

No response

thecoolwinter commented 1 year ago

After some investigation, we’ll need to roll our own ruler view that doesn’t re-draw every line every time it’s invalidated. We should be able to only draw visible line numbers. That will help with the lag the ruler view is causing.

We still need to look into the lag being caused by the text view itself further.

thecoolwinter commented 1 year ago

Fixed with #138