mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Fix reinterpretation dialog for UTF-8
This commit is contained in:
parent
f603dc6aa6
commit
43dcaf03fc
@ -8,6 +8,12 @@
|
||||
- Suppress displaying the dialog for saving in an incompatible encoding when once allowed.
|
||||
|
||||
|
||||
### Fixes
|
||||
|
||||
- Fix an issue that the encoding reinterpretation option dialog is not displayed when the user changes a document encoding to UTF-8.
|
||||
|
||||
|
||||
|
||||
4.7.2 (625)
|
||||
--------------------------
|
||||
|
||||
|
@ -700,7 +700,7 @@ final class Document: NSDocument, AdditionalDocumentPreparing, EncodingChanging
|
||||
|
||||
// remove wrapped NSError to make RecoverableError work
|
||||
// cf. [How to use RecoverableError to retry?](https://stackoverflow.com/questions/40352975/how-to-use-recoverableerror-to-retry)
|
||||
let error = (error as NSError).userInfo[NSUnderlyingErrorKey] as? SavingError ?? error
|
||||
let error = (error as NSError).underlyingErrors.first ?? error
|
||||
|
||||
return super.willPresentError(error)
|
||||
}
|
||||
@ -1046,7 +1046,7 @@ final class Document: NSDocument, AdditionalDocumentPreparing, EncodingChanging
|
||||
guard fileEncoding != self.fileEncoding else { return }
|
||||
|
||||
// change encoding immediately if there is nothing to worry about
|
||||
if self.fileURL == nil || self.textStorage.string.isEmpty || fileEncoding.encoding == .utf8 {
|
||||
if self.fileURL == nil || self.textStorage.string.isEmpty {
|
||||
return self.changeEncoding(to: fileEncoding)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user