Fix calling UI from a background thread

This commit is contained in:
1024jp 2018-03-02 01:03:45 +09:00
parent 6d49fd1aba
commit 857dfcecd7
3 changed files with 5 additions and 2 deletions

View File

@ -16,6 +16,7 @@ unreleased
- Fix an issue where `⌘←` was ignored when the cursor locates at the end of the document.
- Fix an issue where save dialog layout crrupted when toggle visibility of the file browser.
- Fix an issue where no alart was raised on saving even when document contains lossy yen signs.
- Fix a possible crash on print.

View File

@ -641,7 +641,7 @@ final class Document: NSDocument, AdditionalDocumentPreparing, EncodingHolder {
printOperation.canSpawnSeparateThread = true // display print progress panel as a sheet
// setup print panel
self.printPanelAccessoryController.view.setContentHuggingPriority(.fittingSizeCompression, for: .horizontal)
printOperation.printPanel.addAccessoryController(self.printPanelAccessoryController)
printOperation.printPanel.options.formUnion([.showsPaperSize, .showsOrientation, .showsScaling])
return printOperation

View File

@ -385,7 +385,9 @@ final class PrintTextView: NSTextView, NSLayoutManagerDelegate, Themable {
}
if let controller = NSPrintOperation.current?.printPanel.accessoryControllers.first as? PrintPanelAccessoryController {
self.syntaxStyle?.highlightAll { [weak controller] in
if let controller = controller, !controller.view.isHidden {
DispatchQueue.main.async {
guard let controller = controller, !controller.view.isHidden else { return }
controller.needsUpdatePreview = true
}
}