mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-24 03:25:03 +03:00
Cache CTRuns
This commit is contained in:
parent
d191476bfa
commit
0b00529434
@ -143,9 +143,12 @@ final class Typesetter {
|
||||
attributes: [.font: font, .ligature: NSNumber(integerLiteral: 1)]
|
||||
)
|
||||
|
||||
if let cachedCtRuns = ctRunsCache.object(forKey: attrStr) { return cachedCtRuns }
|
||||
|
||||
let ctLine = CTLineCreateWithAttributedString(attrStr)
|
||||
guard let ctRuns = CTLineGetGlyphRuns(ctLine) as? [CTRun] else { return [] }
|
||||
|
||||
ctRunsCache.set(object: ctRuns, forKey: attrStr)
|
||||
return ctRuns
|
||||
}
|
||||
|
||||
@ -272,3 +275,5 @@ final class Typesetter {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private let ctRunsCache = SimpleCache<NSAttributedString, [CTRun]>(countLimit: 10000)
|
||||
|
@ -27,6 +27,15 @@
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "4BEBA5041CFF374B00673FDF"
|
||||
BuildableName = "VimR.app"
|
||||
BlueprintName = "VimR"
|
||||
ReferencedContainer = "container:VimR.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
@ -39,17 +48,6 @@
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "4BEBA5041CFF374B00673FDF"
|
||||
BuildableName = "VimR.app"
|
||||
BlueprintName = "VimR"
|
||||
ReferencedContainer = "container:VimR.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@ -71,8 +69,6 @@
|
||||
ReferencedContainer = "container:VimR.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
Loading…
Reference in New Issue
Block a user