Skip to content

Commit

Permalink
chore: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
lotem committed Feb 9, 2024
1 parent 868e077 commit 04c4127
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/rime/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ bool Context::Highlight(size_t index) {
}
seg.selected_index = new_index;
update_notifier_(this);
DLOG(INFO) << "selection changed from: " << previous_index << " to: " << new_index;
DLOG(INFO) << "selection changed from: " << previous_index
<< " to: " << new_index;
return true;
}

Expand Down
19 changes: 11 additions & 8 deletions src/rime_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1070,10 +1070,10 @@ Bool RimeChangePage(RimeSessionId session_id, Bool backward) {
an<Session> session(Service::instance().GetSession(session_id));
if (!session)
return False;
Context *ctx = session->context();
Context* ctx = session->context();
if (!ctx || !ctx->HasMenu())
return False;
Schema *schema = session->schema();
Schema* schema = session->schema();
if (!schema)
return False;
size_t page_size = (size_t)schema->page_size();
Expand All @@ -1082,9 +1082,9 @@ Bool RimeChangePage(RimeSessionId session_id, Bool backward) {
size_t index =
backward ? (current_index <= page_size ? 0 : current_index - page_size)
: (current_index + page_size);
DLOG(INFO) << "current selection: " << current_index
<< ", flipping " << (backward ? "backward" : "forward")
<< ", new selection " << index;
DLOG(INFO) << "current selection: " << current_index << ", flipping "
<< (backward ? "backward" : "forward") << ", new selection "
<< index;
seg.tags.insert("paging");
return ctx->Highlight(index);
}
Expand All @@ -1093,8 +1093,10 @@ Bool RimeHighlightCandidate(RimeSessionId session_id, size_t index) {
return do_with_candidate(session_id, index, &Context::Highlight);
}

Bool RimeHighlightCandidateOnCurrentPage(RimeSessionId session_id, size_t index) {
return do_with_candidate_on_current_page(session_id, index, &Context::Highlight);
Bool RimeHighlightCandidateOnCurrentPage(RimeSessionId session_id,
size_t index) {
return do_with_candidate_on_current_page(session_id, index,
&Context::Highlight);
}

RIME_API Bool RimeSelectCandidate(RimeSessionId session_id, size_t index) {
Expand Down Expand Up @@ -1263,7 +1265,8 @@ RIME_API RimeApi* rime_get_api() {
s_api.get_staging_dir_s = &RimeGetStagingDirSecure;
s_api.get_sync_dir_s = &RimeGetSyncDirSecure;
s_api.highlight_candidate = &RimeHighlightCandidate;
s_api.highlight_candidate_on_current_page = &RimeHighlightCandidateOnCurrentPage;
s_api.highlight_candidate_on_current_page =
&RimeHighlightCandidateOnCurrentPage;
s_api.change_page = &RimeChangePage;
}
return &s_api;
Expand Down
3 changes: 2 additions & 1 deletion src/rime_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,8 @@ typedef struct rime_api_t {
//! highlight a selection without committing
Bool (*highlight_candidate)(RimeSessionId session_id, size_t index);
//! highlight a selection without committing
Bool (*highlight_candidate_on_current_page)(RimeSessionId session_id, size_t index);
Bool (*highlight_candidate_on_current_page)(RimeSessionId session_id,
size_t index);

Bool (*change_page)(RimeSessionId session_id, Bool backward);
} RimeApi;
Expand Down

0 comments on commit 04c4127

Please sign in to comment.