diff --git a/DictypeFcitx/src/DictypeState.cpp b/DictypeFcitx/src/DictypeState.cpp index d5565fd..764c4c3 100644 --- a/DictypeFcitx/src/DictypeState.cpp +++ b/DictypeFcitx/src/DictypeState.cpp @@ -16,6 +16,9 @@ void DictypeState::clear() { DICTYPE_WARN() << "uncommitted texts: " << getUncommittedText(); texts_.clear(); } + errorMsg_.clear(); + stage_ = DictypeStage::Closed; + inputContext_.unwatch(); cleared_ = true; } diff --git a/DictypeFcitx/src/DictypeState.test.cpp b/DictypeFcitx/src/DictypeState.test.cpp index bb5fd7a..07cd274 100644 --- a/DictypeFcitx/src/DictypeState.test.cpp +++ b/DictypeFcitx/src/DictypeState.test.cpp @@ -108,8 +108,8 @@ TEST(DictypeStateTest, RetainErrorMessageUntilNewSession) { EXPECT_EQ(state.getErrorMsg(), "boom"); state.clear(); - EXPECT_EQ(state.getStage(), DictypeStage::Errored); - EXPECT_EQ(state.getErrorMsg(), "boom"); + EXPECT_EQ(state.getStage(), DictypeStage::Closed); + EXPECT_EQ(state.getErrorMsg(), ""); state.newSession(nullptr); EXPECT_EQ(state.getStage(), DictypeStage::Closed);