Fix unwanted syntax highligt progress for finished operation

This commit is contained in:
1024jp 2017-11-06 00:19:28 +09:00
parent fcdb37b625
commit a881d42a97
2 changed files with 13 additions and 2 deletions

View File

@ -2,6 +2,15 @@
Change Log
==========================
3.2.5
--------------------------
### Fixes
- Fix an issue where the syntax highlighting indicator could display twice.
3.2.4 (207)
--------------------------

View File

@ -445,13 +445,15 @@ extension SyntaxStyle {
if let storage = self.textStorage, self.shouldShowIndicator(for: highlightRange.length) {
// wait for window becomes ready
DispatchQueue.global(qos: .background).async {
while storage.layoutManagers.isEmpty && (!operation.isFinished || !operation.isCancelled) {
while storage.layoutManagers.isEmpty {
if operation.isFinished || operation.isCancelled { return }
usleep(100)
}
// attach the indicator as a sheet
DispatchQueue.main.sync {
guard !operation.isFinished || !operation.isCancelled,
guard !operation.isFinished, !operation.isCancelled,
let contentViewController = storage.layoutManagers.first?.firstTextView?.viewControllerForSheet
else { return }