diff --git a/src/rime/gear/navigator.cc b/src/rime/gear/navigator.cc index 9a2d128d0..c3a636215 100644 --- a/src/rime/gear/navigator.cc +++ b/src/rime/gear/navigator.cc @@ -60,6 +60,9 @@ Navigator::Navigator(const Ticket& ticket) Config* config = engine_->schema()->config(); LoadConfig(config, "navigator", Horizontal); LoadConfig(config, "navigator/vertical", Vertical); + + engine_->context()->select_notifier().connect( + [this](Context* ctx) { OnSelect(ctx); }); } ProcessResult Navigator::ProcessKeyEvent(const KeyEvent& key_event) { @@ -74,6 +77,10 @@ ProcessResult Navigator::ProcessKeyEvent(const KeyEvent& key_event) { FallbackOptions::All); } +void Navigator::OnSelect(Context* ctx) { + spans_.Clear(); +} + bool Navigator::LeftBySyllable(Context* ctx) { BeginMove(ctx); size_t confirmed_pos = ctx->composition().GetConfirmedPosition(); diff --git a/src/rime/gear/navigator.h b/src/rime/gear/navigator.h index 53ea35cb4..f6205e8ba 100644 --- a/src/rime/gear/navigator.h +++ b/src/rime/gear/navigator.h @@ -42,6 +42,7 @@ class Navigator : public Processor, public KeyBindingProcessor { bool MoveRight(Context* ctx); bool GoHome(Context* ctx); bool GoToEnd(Context* ctx); + void OnSelect(Context*); string input_; Spans spans_;