mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Update status label color immediately
This commit is contained in:
parent
e956d1167d
commit
a478851781
@ -2,6 +2,15 @@
|
||||
Change Log
|
||||
==========================
|
||||
|
||||
3.8.5 (unreleased)
|
||||
--------------------------
|
||||
|
||||
### Fixes
|
||||
|
||||
- Fix an issue where the label color in the status bar was sometimes not updated immediately after switching window apperance.
|
||||
|
||||
|
||||
|
||||
3.8.4 (381)
|
||||
--------------------------
|
||||
|
||||
|
@ -32,6 +32,9 @@ final class StatusBarController: NSViewController {
|
||||
private var defaultsObservers: [UserDefaultsObservation] = []
|
||||
private let byteCountFormatter = ByteCountFormatter()
|
||||
|
||||
@available(macOS, deprecated: 10.15)
|
||||
private var appearanceObserver: NSKeyValueObservation?
|
||||
|
||||
@objc private dynamic var editorStatus: NSAttributedString?
|
||||
@objc private dynamic var documentStatus: NSAttributedString?
|
||||
@objc private dynamic var showsReadOnly = false
|
||||
@ -43,6 +46,7 @@ final class StatusBarController: NSViewController {
|
||||
|
||||
deinit {
|
||||
self.defaultsObservers.forEach { $0.invalidate() }
|
||||
self.appearanceObserver?.invalidate()
|
||||
}
|
||||
|
||||
|
||||
@ -95,6 +99,13 @@ final class StatusBarController: NSViewController {
|
||||
|
||||
self.documentAnalyzer?.needsUpdateStatusEditorInfo = true
|
||||
self.documentAnalyzer?.invalidateEditorInfo()
|
||||
|
||||
if #available(macOS 10.15, *) { } else {
|
||||
self.appearanceObserver?.invalidate()
|
||||
self.appearanceObserver = self.view.observe(\.effectiveAppearance) { [weak self] (_, _) in
|
||||
self?.updateEditorStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -104,6 +115,8 @@ final class StatusBarController: NSViewController {
|
||||
super.viewDidDisappear()
|
||||
|
||||
self.documentAnalyzer?.needsUpdateStatusEditorInfo = false
|
||||
|
||||
self.appearanceObserver?.invalidate()
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user