diff --git a/sources/SquirrelConfig.swift b/sources/SquirrelConfig.swift index 75b0eeb79..3ae74a94c 100644 --- a/sources/SquirrelConfig.swift +++ b/sources/SquirrelConfig.swift @@ -113,34 +113,6 @@ final class SquirrelConfig { rimeAPI.config_end(&iterator) return appOptions } - - // isLinear - func updateCandidateListLayout(prefix: String) -> Bool { - let candidateListLayout = getString("\(prefix)/candidate_list_layout") - switch candidateListLayout { - case "stacked": - return false - case "linear": - return true - default: - // Deprecated. Not to be confused with text_orientation: horizontal - return getBool("\(prefix)/horizontal") ?? false - } - } - - // isVertical - func updateTextOrientation(prefix: String) -> Bool { - let textOrientation = getString("\(prefix)/text_orientation") - switch textOrientation { - case "horizontal": - return false - case "vertical": - return true - default: - // Deprecated. - return getBool("\(prefix)/vertical") ?? false - } - } } private extension SquirrelConfig { diff --git a/sources/SquirrelTheme.swift b/sources/SquirrelTheme.swift index 76a1c1c44..ea41c9636 100644 --- a/sources/SquirrelTheme.swift +++ b/sources/SquirrelTheme.swift @@ -166,8 +166,8 @@ final class SquirrelTheme { } func load(config: SquirrelConfig, dark: Bool) { - linear = config.updateCandidateListLayout(prefix: "style") - vertical = config.updateTextOrientation(prefix: "style") + linear ?= config.getString("style/candidate_list_layout").map { $0 == "linear" } + vertical ?= config.getString("style/text_orientation").map { $0 == "vertical" } inlinePreedit ?= config.getBool("style/inline_preedit") inlineCandidate ?= config.getBool("style/inline_candidate") translucency ?= config.getBool("style/translucency") @@ -219,6 +219,8 @@ final class SquirrelTheme { // the following per-color-scheme configurations, if exist, will // override configurations with the same name under the global 'style' // section + linear ?= config.getString("\(prefix)/candidate_list_layout").map { $0 == "linear" } + vertical ?= config.getString("\(prefix)/text_orientation").map { $0 == "vertical" } inlinePreedit ?= config.getBool("\(prefix)/inline_preedit") inlineCandidate ?= config.getBool("\(prefix)/inline_candidate") translucency ?= config.getBool("\(prefix)/translucency")