Skip to content

Commit

Permalink
update linear and vertical in color scheme
Browse files Browse the repository at this point in the history
Fix #912
Remove "style/horizontal" and "style/vertical"
  • Loading branch information
LEOYoon-Tsaw committed May 31, 2024
1 parent abab3f9 commit 1d7823a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 30 deletions.
28 changes: 0 additions & 28 deletions sources/SquirrelConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions sources/SquirrelTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 1d7823a

Please sign in to comment.