!1442 [Bug]: 去重OnSelectionChange

Merge pull request !1442 from 赵凌岚/master
This commit is contained in:
openharmony_ci 2024-09-02 14:39:47 +00:00 committed by Gitee
commit 4d1abf7617
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -478,7 +478,11 @@ int32_t InputMethodAbility::InvokeStartInputCallback(const TextTotalConfig &text
kdListener_->OnCursorUpdate(textConfig.cursorInfo.left, textConfig.cursorInfo.top,
textConfig.cursorInfo.height);
}
if (textConfig.textSelection.newBegin != INVALID_SELECTION_VALUE) {
if (textConfig.textSelection.newBegin == INVALID_SELECTION_VALUE
|| (textConfig.textSelection.newBegin == textConfig.textSelection.oldBegin
&& textConfig.textSelection.newEnd == textConfig.textSelection.oldEnd)) {
IMSA_HILOGD("invalid selection or no selection change");
} else {
kdListener_->OnSelectionChange(textConfig.textSelection.oldBegin, textConfig.textSelection.oldEnd,
textConfig.textSelection.newBegin, textConfig.textSelection.newEnd);
}