You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using TextStorageSystemInterface, initial highlighting works fine. Adding text to the end of the file works fine too. Adding text somewhere else doesn't seem to highlight it.
I did some digging and couldn't find an immediate reason why it's happening. In the beginValidation function (RangeValidator.swift), the following line will return .none, which is probably unexpected.
guard let neededRange =nextNeededRange(in: set, prioritizing: range)else{return.none }
Reproducing the issue: open the sample project, in TextViewSystemInterface comment out the first two interfaces in effectiveInterface, so the TextStorageSystemInterface is used. Then, try editing the text somewhere in the middle.
The text was updated successfully, but these errors were encountered:
Ok reproduced. Also not sure what is wrong. But I suspect it is either timing, or bad interaction between the text view typing attributes and the storage. I don't use storage-based attributes ever myself so I'm not surprised this is problematic.
Made little process here. Even you force TextViewSystemInterface.effectiveInterface to always return a TextStorageSystemInterface, NSTextView.visibleTextRange will still make use of TextKit2 to calculate the visible ranges. Those calculations are wrong, but I'm not sure yet whether I'm doing it incorrectly or TextKit 2 is just returning in correct results.
But I bet it is TextKit 2 returning stale information because of its async layout calculations.
When using TextStorageSystemInterface, initial highlighting works fine. Adding text to the end of the file works fine too. Adding text somewhere else doesn't seem to highlight it.
I did some digging and couldn't find an immediate reason why it's happening. In the
beginValidation
function (RangeValidator.swift), the following line will return.none
, which is probably unexpected.Reproducing the issue: open the sample project, in
TextViewSystemInterface
comment out the first two interfaces ineffectiveInterface
, so theTextStorageSystemInterface
is used. Then, try editing the text somewhere in the middle.The text was updated successfully, but these errors were encountered: