mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 19:27:30 +03:00
Forcibly cast notification object
This commit is contained in:
parent
407e031e36
commit
9e65605585
@ -88,9 +88,9 @@ final class FindPanelFieldViewController: NSViewController, NSTextViewDelegate {
|
||||
// observe find result notifications from TextFinder and its expiration
|
||||
self.resultObservers = [
|
||||
NotificationCenter.default.publisher(for: TextFinder.didFindNotification)
|
||||
.map { $0.object as? TextFinder }
|
||||
.map { $0.object as! TextFinder }
|
||||
.receive(on: RunLoop.main)
|
||||
.sink { [weak self] in self?.update(result: $0?.findResult) },
|
||||
.sink { [weak self] in self?.update(result: $0.findResult) },
|
||||
NotificationCenter.default.publisher(for: NSWindow.didResignMainNotification)
|
||||
.sink { [weak self] _ in self?.update(result: nil) },
|
||||
]
|
||||
|
@ -54,7 +54,7 @@ import ValueRange
|
||||
self.inconsistentLineEndings = self.lineEndings.filter { $0.value != lineEnding }
|
||||
|
||||
self.storageObserver = NotificationCenter.default.publisher(for: NSTextStorage.didProcessEditingNotification, object: textStorage)
|
||||
.compactMap { $0.object as? NSTextStorage }
|
||||
.map { $0.object as! NSTextStorage }
|
||||
.filter { $0.editedMask.contains(.editedCharacters) }
|
||||
.sink { [weak self] in self?.invalidate(string: $0.string, in: $0.editedRange, changeInLength: $0.changeInLength) }
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ final class LineNumberView: NSView {
|
||||
.sink { [weak self] in
|
||||
self?.invalidateThickness()
|
||||
self?.textStorageObserver = NotificationCenter.default.publisher(for: NSTextStorage.didProcessEditingNotification, object: $0)
|
||||
.compactMap { $0.object as? NSTextStorage }
|
||||
.map { $0.object as! NSTextStorage }
|
||||
.filter { $0.editedMask.contains(.editedCharacters) }
|
||||
.receive(on: RunLoop.main) // touch textView on main thread
|
||||
.sink { [weak self] _ in
|
||||
|
Loading…
Reference in New Issue
Block a user