Skip to content

Commit

Permalink
fix(navigator): wrong spans after selection (#952)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksqsf authored Nov 18, 2024
1 parent c7ab639 commit 0a983b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/rime/gear/navigator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/rime/gear/navigator.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Navigator : public Processor, public KeyBindingProcessor<Navigator, 2> {
bool MoveRight(Context* ctx);
bool GoHome(Context* ctx);
bool GoToEnd(Context* ctx);
void OnSelect(Context*);

string input_;
Spans spans_;
Expand Down

0 comments on commit 0a983b4

Please sign in to comment.