Skip to content

Commit 1d7823a

Browse files
committed
update linear and vertical in color scheme
Fix #912 Remove "style/horizontal" and "style/vertical"
1 parent abab3f9 commit 1d7823a

File tree

2 files changed

+4
-30
lines changed

2 files changed

+4
-30
lines changed

sources/SquirrelConfig.swift

-28
Original file line numberDiff line numberDiff line change
@@ -113,34 +113,6 @@ final class SquirrelConfig {
113113
rimeAPI.config_end(&iterator)
114114
return appOptions
115115
}
116-
117-
// isLinear
118-
func updateCandidateListLayout(prefix: String) -> Bool {
119-
let candidateListLayout = getString("\(prefix)/candidate_list_layout")
120-
switch candidateListLayout {
121-
case "stacked":
122-
return false
123-
case "linear":
124-
return true
125-
default:
126-
// Deprecated. Not to be confused with text_orientation: horizontal
127-
return getBool("\(prefix)/horizontal") ?? false
128-
}
129-
}
130-
131-
// isVertical
132-
func updateTextOrientation(prefix: String) -> Bool {
133-
let textOrientation = getString("\(prefix)/text_orientation")
134-
switch textOrientation {
135-
case "horizontal":
136-
return false
137-
case "vertical":
138-
return true
139-
default:
140-
// Deprecated.
141-
return getBool("\(prefix)/vertical") ?? false
142-
}
143-
}
144116
}
145117

146118
private extension SquirrelConfig {

sources/SquirrelTheme.swift

+4-2
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ final class SquirrelTheme {
166166
}
167167

168168
func load(config: SquirrelConfig, dark: Bool) {
169-
linear = config.updateCandidateListLayout(prefix: "style")
170-
vertical = config.updateTextOrientation(prefix: "style")
169+
linear ?= config.getString("style/candidate_list_layout").map { $0 == "linear" }
170+
vertical ?= config.getString("style/text_orientation").map { $0 == "vertical" }
171171
inlinePreedit ?= config.getBool("style/inline_preedit")
172172
inlineCandidate ?= config.getBool("style/inline_candidate")
173173
translucency ?= config.getBool("style/translucency")
@@ -219,6 +219,8 @@ final class SquirrelTheme {
219219
// the following per-color-scheme configurations, if exist, will
220220
// override configurations with the same name under the global 'style'
221221
// section
222+
linear ?= config.getString("\(prefix)/candidate_list_layout").map { $0 == "linear" }
223+
vertical ?= config.getString("\(prefix)/text_orientation").map { $0 == "vertical" }
222224
inlinePreedit ?= config.getBool("\(prefix)/inline_preedit")
223225
inlineCandidate ?= config.getBool("\(prefix)/inline_candidate")
224226
translucency ?= config.getBool("\(prefix)/translucency")

0 commit comments

Comments
 (0)