Skip to content

correct logic wa_chromium_flag#195

Closed
Zebra2711 wants to merge 1 commit intoLotusInputMethod:devfrom
Zebra2711:chromium
Closed

correct logic wa_chromium_flag#195
Zebra2711 wants to merge 1 commit intoLotusInputMethod:devfrom
Zebra2711:chromium

Conversation

@Zebra2711
Copy link
Copy Markdown
Contributor

:)))))) làm gọn cái hàm if else xong bị sai logic

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the string commitment logic in src/lotus-state.cpp to handle the wa_chromium_flag independently, ensuring that logging and event filtering are bypassed when the flag is active. A review comment suggests a more concise implementation to avoid duplicating the commitString call.

Comment on lines +664 to 671
if (wa_chromium_flag) {
ic_->commitString(addedPart);
} else if (wasAutoCapitalized || addedPart != keyUtf8) {
ic_->commitString(addedPart);
LOTUS_INFO("Commit: " + addedPart);
if (!wa_chromium_flag) {
keyEvent.filterAndAccept();
isCommit = true;
}
keyEvent.filterAndAccept();
isCommit = true;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this change corrects the logic, it introduces code duplication with ic_->commitString(addedPart) being called in both branches. You can refactor this to avoid duplication and simplify the structure, which improves maintainability.

Suggested change
if (wa_chromium_flag) {
ic_->commitString(addedPart);
} else if (wasAutoCapitalized || addedPart != keyUtf8) {
ic_->commitString(addedPart);
LOTUS_INFO("Commit: " + addedPart);
if (!wa_chromium_flag) {
keyEvent.filterAndAccept();
isCommit = true;
}
keyEvent.filterAndAccept();
isCommit = true;
}
if (wa_chromium_flag || wasAutoCapitalized || addedPart != keyUtf8) {
ic_->commitString(addedPart);
if (!wa_chromium_flag) {
LOTUS_INFO("Commit: " + addedPart);
keyEvent.filterAndAccept();
isCommit = true;
}
}

@Zebra2711 Zebra2711 closed this Mar 30, 2026
@github-project-automation github-project-automation bot moved this from Backlog to Done in Kanban Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant