From f327dc1387f61ca4658c199d5a32d38cfb671006 Mon Sep 17 00:00:00 2001 From: ksqsf Date: Sun, 17 Nov 2024 18:09:21 +0100 Subject: [PATCH] fix(navigator): wrong spans after selection --- src/rime/gear/navigator.cc | 7 +++++++ src/rime/gear/navigator.h | 1 + 2 files changed, 8 insertions(+) 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_;