diff --git a/CHANGES.md b/CHANGES.md index fa504e5a..8caca9dd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,13 @@ # Changelog +### 3.6.1 + +Fixes [#324](https://github.com/acejump/AceJump/issues/314). Thanks @AlexPl292! + +Fixes [#325](https://github.com/acejump/AceJump/issues/325). + +Fixes Pinyin support. + ### 3.6.0 Adds support for Chinese [#314](https://github.com/acejump/AceJump/issues/314). diff --git a/src/main/kotlin/org/acejump/config/AceSettings.kt b/src/main/kotlin/org/acejump/config/AceSettings.kt index 92794173..19f6947e 100644 --- a/src/main/kotlin/org/acejump/config/AceSettings.kt +++ b/src/main/kotlin/org/acejump/config/AceSettings.kt @@ -11,17 +11,19 @@ import kotlin.reflect.KProperty */ // TODO: https://github.com/acejump/AceJump/issues/215 -data class AceSettings(var layout: KeyLayout = QWERTY, - var allowedChars: String = layout.text, - // These must be primitives in order to be serializable - internal var jumpModeRGB: Int = BLUE.rgb, - internal var targetModeRGB: Int = RED.rgb, - internal var definitionModeRGB: Int = MAGENTA.rgb, - internal var textHighlightRGB: Int = GREEN.rgb, - internal var tagForegroundRGB: Int = BLACK.rgb, - internal var tagBackgroundRGB: Int = YELLOW.rgb, - internal var displayQuery: Boolean = false, - internal var supportPinyin: Boolean = true) { +data class AceSettings( + var layout: KeyLayout = QWERTY, + var allowedChars: String = layout.text, + // These must be primitives in order to be serializable + internal var jumpModeRGB: Int = BLUE.rgb, + internal var targetModeRGB: Int = RED.rgb, + internal var definitionModeRGB: Int = MAGENTA.rgb, + internal var textHighlightRGB: Int = GREEN.rgb, + internal var tagForegroundRGB: Int = BLACK.rgb, + internal var tagBackgroundRGB: Int = YELLOW.rgb, + internal var displayQuery: Boolean = false, + internal var supportPinyin: Boolean = false +) { // ...but we expose them to the world as Color val jumpModeColor: Color by { jumpModeRGB } diff --git a/src/main/kotlin/org/acejump/config/AceSettingsPanel.kt b/src/main/kotlin/org/acejump/config/AceSettingsPanel.kt index 19776729..fa9e8913 100644 --- a/src/main/kotlin/org/acejump/config/AceSettingsPanel.kt +++ b/src/main/kotlin/org/acejump/config/AceSettingsPanel.kt @@ -33,7 +33,7 @@ internal class AceSettingsPanel { private val textHighlightColorWheel = ColorPanel() private val tagForegroundColorWheel = ColorPanel() private val tagBackgroundColorWheel = ColorPanel() - private val displayQueryCheckBox = JBCheckBox() + private val displayQueryCheckBox = JBCheckBox().apply { isEnabled = false } private val supportPinyinCheckBox = JBCheckBox() init { @@ -104,6 +104,6 @@ internal class AceSettingsPanel { private operator fun ColorPanel.getValue(a: AceSettingsPanel, p: KProperty<*>) = selectedColor private operator fun ColorPanel.setValue(a: AceSettingsPanel, p: KProperty<*>, c: Color?) = setSelectedColor(c) - private operator fun JCheckBox.getValue(a: AceSettingsPanel, p: KProperty<*>) = isEnabled - private operator fun JCheckBox.setValue(a: AceSettingsPanel, p: KProperty<*>, enabled: Boolean) = setEnabled(enabled) + private operator fun JCheckBox.getValue(a: AceSettingsPanel, p: KProperty<*>) = isSelected + private operator fun JCheckBox.setValue(a: AceSettingsPanel, p: KProperty<*>, selected: Boolean) = setSelected(selected) } \ No newline at end of file diff --git a/src/main/kotlin/org/acejump/view/Model.kt b/src/main/kotlin/org/acejump/view/Model.kt index 776ad92a..f680874a 100644 --- a/src/main/kotlin/org/acejump/view/Model.kt +++ b/src/main/kotlin/org/acejump/view/Model.kt @@ -33,11 +33,10 @@ object Model { get() = editor.document.text .let { if (AceConfig.supportPinyin) it.mapToPinyin() else it } - private fun String.mapToPinyin() = - chars().run { if(DEFAULT_BUFFER < length) parallel() else this }.mapToObj { - if (UnicodeScript.of(it) == UnicodeScript.HAN) - pinyin.translateFirstChar(it.toString()).first() else it.toChar() - }.toArray().joinToString("") + private fun String.mapToPinyin() = map { + if (UnicodeScript.of(it.toInt()) == UnicodeScript.HAN) + pinyin.translateFirstChar(it.toString()).first() else it + }.joinToString("") val pinyin = Pinyin()