Fix find string sync

This commit is contained in:
1024jp 2017-01-12 21:15:57 +09:00
parent 48168a992d
commit 5094b788a1
2 changed files with 10 additions and 13 deletions

View File

@ -19,6 +19,7 @@ develop
### Fixes
- Fix an issue where the application could crash after lossy encoding change.
- Fix an issue where the find string was not synchronized with other applications.
- Fix an issue where incompatible characters highlight could highlight wrong characters if line endings are CR/LF.
- Fix an issue the menu item “About Scripting” in Help > “CotEditor Scripting Manual” didn't work.
- Fix an issue where the zoomed character in the character inspector was flipped when the popover is detached.

View File

@ -9,7 +9,7 @@
------------------------------------------------------------------------------
© 2015-2016 1024jp
© 2015-2017 1024jp
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -89,7 +89,14 @@ final class TextFinder: NSResponder, TextFinderSettingsProvider {
// MARK: Public Properties
dynamic var findString = ""
dynamic var findString = "" {
didSet {
if self.sharesFindString {
NSPasteboard.findString = self.findString
}
}
}
dynamic var replacementString = ""
weak var delegate: TextFinderDelegate?
@ -125,8 +132,6 @@ final class TextFinder: NSResponder, TextFinderSettingsProvider {
// observe application activation to sync find string with other apps
NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive), name: .NSApplicationDidBecomeActive, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(applicationWillResignActive), name: .NSApplicationWillResignActive, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(applicationWillResignActive), name: .NSApplicationWillTerminate, object: nil)
}
@ -186,15 +191,6 @@ final class TextFinder: NSResponder, TextFinderSettingsProvider {
}
/// sync search string on deactivating application
func applicationWillResignActive(_ notification: Notification) {
if self.sharesFindString {
NSPasteboard.findString = self.findString
}
}
// MARK: Action Messages