From 32cc1d9784213a1bb8d31b38ec170229e8dbe7b6 Mon Sep 17 00:00:00 2001 From: shewer Date: Thu, 20 Jun 2024 17:29:04 +0800 Subject: [PATCH] add ResetUserDict() Signed-off-by: shewer --- src/rime/algo/syllabifier.h | 2 +- src/rime/gear/memory.cc | 4 ++++ src/rime/gear/memory.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/rime/algo/syllabifier.h b/src/rime/algo/syllabifier.h index 157e03f29c..1d46682c01 100644 --- a/src/rime/algo/syllabifier.h +++ b/src/rime/algo/syllabifier.h @@ -20,7 +20,7 @@ class Corrector; using SyllableId = int32_t; struct EdgeProperties : SpellingProperties { - EdgeProperties(SpellingProperties sup) : SpellingProperties(sup) {}; + EdgeProperties(SpellingProperties sup) : SpellingProperties(sup){}; EdgeProperties() = default; bool is_correction = false; }; diff --git a/src/rime/gear/memory.cc b/src/rime/gear/memory.cc index ad475cabac..0652fb919c 100644 --- a/src/rime/gear/memory.cc +++ b/src/rime/gear/memory.cc @@ -86,6 +86,10 @@ Memory::~Memory() { unhandled_key_connection_.disconnect(); } +void Memory::ResetUserDict() { + user_dict_.reset(); +} + bool Memory::StartSession() { return user_dict_ && user_dict_->NewTransaction(); } diff --git a/src/rime/gear/memory.h b/src/rime/gear/memory.h index 0b065491fb..d60b1a2b93 100644 --- a/src/rime/gear/memory.h +++ b/src/rime/gear/memory.h @@ -47,6 +47,7 @@ class Memory { UserDictionary* user_dict() const { return user_dict_.get(); } const Language* language() const { return language_.get(); } + void ResetUserDict(); protected: void OnCommit(Context* ctx);