File tree 4 files changed +39
-9
lines changed
4 files changed +39
-9
lines changed Original file line number Diff line number Diff line change
1
+ //
2
+ // Copyright RIME Developers
3
+ // Distributed under the BSD License
4
+ //
5
+ #include < boost/algorithm/string.hpp>
6
+ #include < rime/config/config_compiler_impl.h>
7
+ #include < rime/config/config_cow_ref.h>
8
+ #include < rime/config/plugins.h>
9
+
10
+ namespace rime {
11
+
12
+ bool DefaultConfigPlugin::ReviewCompileOutput (
13
+ ConfigCompiler* compiler, an<ConfigResource> resource) {
14
+ return true ;
15
+ }
16
+
17
+ bool DefaultConfigPlugin::ReviewLinkOutput (
18
+ ConfigCompiler* compiler, an<ConfigResource> resource) {
19
+ if (!boost::ends_with (resource->resource_id , " .schema" ))
20
+ return true ;
21
+ auto target = Cow (resource, " menu" );
22
+ Reference reference{" default" , " menu" , true };
23
+ if (!IncludeReference{reference}
24
+ .TargetedAt (target).Resolve (compiler)) {
25
+ LOG (ERROR) << " failed to include section " << reference;
26
+ return false ;
27
+ }
28
+ return true ;
29
+ }
30
+
31
+ } // namespace rime
Original file line number Diff line number Diff line change @@ -27,6 +27,12 @@ class AutoPatchConfigPlugin : public ConfigCompilerPlugin {
27
27
Review ReviewLinkOutput;
28
28
};
29
29
30
+ class DefaultConfigPlugin : public ConfigCompilerPlugin {
31
+ public:
32
+ Review ReviewCompileOutput;
33
+ Review ReviewLinkOutput;
34
+ };
35
+
30
36
class LegacyPresetConfigPlugin : public ConfigCompilerPlugin {
31
37
public:
32
38
Review ReviewCompileOutput;
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ static void rime_core_initialize() {
22
22
23
23
auto config = new ConfigComponent;
24
24
config->InstallPlugin (new AutoPatchConfigPlugin);
25
+ config->InstallPlugin (new DefaultConfigPlugin);
25
26
config->InstallPlugin (new LegacyPresetConfigPlugin);
26
27
config->InstallPlugin (new LegacyDictionaryConfigPlugin);
27
28
r.Register (" config" , config);
Original file line number Diff line number Diff line change @@ -31,15 +31,7 @@ void Schema::FetchUsefulConfigItems() {
31
31
if (!config_->GetString (" schema/name" , &schema_name_)) {
32
32
schema_name_ = schema_id_;
33
33
}
34
- if (!config_->GetInt (" menu/page_size" , &page_size_) &&
35
- schema_id_ != " .default" ) {
36
- // not defined in schema, use default setting
37
- the<Config> default_config (
38
- Config::Require (" config" )->Create (" default" ));
39
- if (default_config) {
40
- default_config->GetInt (" menu/page_size" , &page_size_);
41
- }
42
- }
34
+ config_->GetInt (" menu/page_size" , &page_size_);
43
35
config_->GetString (" menu/alternative_select_keys" , &select_keys_);
44
36
}
45
37
You can’t perform that action at this time.
0 commit comments