mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Make sure snippet is saved
This commit is contained in:
parent
5f45e46ceb
commit
05ba0b26bb
@ -13,6 +13,7 @@ Change Log
|
||||
### Fixes
|
||||
|
||||
- Fix an issue in the search window that an error dialog for invalid regular expression appeared even on incremental search.
|
||||
- [beta] Fix an issue that the snippet setting was occasionally not saved.
|
||||
|
||||
|
||||
|
||||
|
@ -81,6 +81,15 @@ final class SnippetsViewController: NSViewController, NSTableViewDataSource, NST
|
||||
}
|
||||
|
||||
|
||||
override func viewWillDisappear() {
|
||||
|
||||
super.viewWillDisappear()
|
||||
|
||||
self.endEditing()
|
||||
self.saveSetting()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// MARK: Table View Data Source
|
||||
|
||||
@ -136,7 +145,7 @@ final class SnippetsViewController: NSViewController, NSTableViewDataSource, NST
|
||||
self.snippets.move(fromOffsets: sourceRows, toOffset: row)
|
||||
tableView.moveRows(at: sourceRows, to: row)
|
||||
|
||||
self.saveSettings()
|
||||
self.saveSetting()
|
||||
|
||||
return true
|
||||
}
|
||||
@ -185,7 +194,7 @@ final class SnippetsViewController: NSViewController, NSTableViewDataSource, NST
|
||||
else { return }
|
||||
|
||||
self.snippets[tableView.selectedRow].format = textView.string
|
||||
self.saveSettings()
|
||||
self.saveSetting()
|
||||
}
|
||||
|
||||
|
||||
@ -213,7 +222,7 @@ final class SnippetsViewController: NSViewController, NSTableViewDataSource, NST
|
||||
preconditionFailure()
|
||||
}
|
||||
|
||||
self.saveSettings()
|
||||
self.saveSetting()
|
||||
}
|
||||
|
||||
|
||||
@ -228,7 +237,7 @@ final class SnippetsViewController: NSViewController, NSTableViewDataSource, NST
|
||||
|
||||
// successfully update data
|
||||
self.snippets[row].name = sender.stringValue
|
||||
self.saveSettings()
|
||||
self.saveSetting()
|
||||
tableView.reloadData(forRowIndexes: [row], columnIndexes: [column])
|
||||
}
|
||||
|
||||
@ -269,7 +278,7 @@ final class SnippetsViewController: NSViewController, NSTableViewDataSource, NST
|
||||
|
||||
// successfully update data
|
||||
self.snippets[row].shortcut = shortcut
|
||||
self.saveSettings()
|
||||
self.saveSetting()
|
||||
tableView.reloadData(forRowIndexes: [row], columnIndexes: [column])
|
||||
}
|
||||
|
||||
@ -277,8 +286,8 @@ final class SnippetsViewController: NSViewController, NSTableViewDataSource, NST
|
||||
|
||||
// MARK: Private Methods
|
||||
|
||||
/// Save current settings.
|
||||
private func saveSettings() {
|
||||
/// Save current setting.
|
||||
private func saveSetting() {
|
||||
|
||||
SnippetManager.shared.save(self.snippets)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user