Rename .encodingInNew key with .encoding

This commit is contained in:
1024jp 2024-02-19 08:49:39 +09:00
parent 621c92ad61
commit 36f41052df
3 changed files with 5 additions and 5 deletions

View File

@ -105,7 +105,7 @@ extension DefaultKeys {
// Format
static let lineEndCharCode = DefaultKey<Int>("defaultLineEndCharCode")
static let encodingList = DefaultKey<[CFStringEncoding]>("encodingList")
static let encodingInNew = DefaultKey<UInt>("encodingInNew")
static let encoding = DefaultKey<UInt>("encodingInNew")
static let saveUTF8BOM = DefaultKey<Bool>("saveUTF8BOM")
static let referToEncodingTag = DefaultKey<Bool>("referToEncodingTag")
static let syntax = DefaultKey<String>("defaultColoringStyleName")

View File

@ -9,7 +9,7 @@
// ---------------------------------------------------------------------------
//
// © 2004-2007 nakamuxu
// © 2014-2023 1024jp
// © 2014-2024 1024jp
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -99,7 +99,7 @@ struct DefaultSettings {
.lineEndCharCode: 0,
.encodingList: DefaultSettings.encodings.map(UInt.init),
.encodingInNew: String.Encoding.utf8.rawValue,
.encoding: String.Encoding.utf8.rawValue,
.saveUTF8BOM: false,
.referToEncodingTag: true,
.syntax: "Plain Text",

View File

@ -69,7 +69,7 @@ final class EncodingManager {
var defaultEncoding: FileEncoding {
get {
let encoding = String.Encoding(rawValue: UserDefaults.standard[.encodingInNew])
let encoding = String.Encoding(rawValue: UserDefaults.standard[.encoding])
let availableEncoding = String.availableStringEncodings.contains(encoding) ? encoding : .utf8
let withBOM = (availableEncoding == .utf8) && UserDefaults.standard[.saveUTF8BOM]
@ -77,7 +77,7 @@ final class EncodingManager {
}
set {
UserDefaults.standard[.encodingInNew] = newValue.encoding.rawValue
UserDefaults.standard[.encoding] = newValue.encoding.rawValue
UserDefaults.standard[.saveUTF8BOM] = newValue.withUTF8BOM
}
}