Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(navigator): wrong spans after selection #952

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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