aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/TextHostControlService.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-10-21 17:44:56 +0800
committercrupest <crupest@outlook.com>2021-10-21 17:44:56 +0800
commit72fc892792565ef39fcae6b7d2a19006dc3a3238 (patch)
treeea1609b424215e6fe86d6280ce86beea0c73b61b /src/ui/controls/TextHostControlService.cpp
parentfc9cd10a84ea92dd702ac84d302ca46198d17d23 (diff)
downloadcru-72fc892792565ef39fcae6b7d2a19006dc3a3238.tar.gz
cru-72fc892792565ef39fcae6b7d2a19006dc3a3238.tar.bz2
cru-72fc892792565ef39fcae6b7d2a19006dc3a3238.zip
...
Diffstat (limited to 'src/ui/controls/TextHostControlService.cpp')
-rw-r--r--src/ui/controls/TextHostControlService.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/ui/controls/TextHostControlService.cpp b/src/ui/controls/TextHostControlService.cpp
index 07b4f1e8..2f096126 100644
--- a/src/ui/controls/TextHostControlService.cpp
+++ b/src/ui/controls/TextHostControlService.cpp
@@ -59,8 +59,7 @@ void TextHostControlService::SetEditable(bool editable) {
if (!editable) CancelComposition();
}
-void TextHostControlService::SetText(std::u16string text,
- bool stop_composition) {
+void TextHostControlService::SetText(String text, bool stop_composition) {
this->text_ = std::move(text);
CoerceSelection();
if (stop_composition) {
@@ -259,7 +258,7 @@ void TextHostControlService::SyncTextRenderObject() {
if (composition_info) {
const auto caret_position = GetCaretPosition();
auto text = this->text_;
- text.insert(caret_position, composition_info->text);
+ text.insert(text.cbegin() + caret_position, composition_info->text);
text_render_object->SetText(text);
text_render_object->SetCaretPosition(caret_position +
composition_info->selection.GetEnd());
@@ -284,7 +283,7 @@ void TextHostControlService::UpdateInputMethodPosition() {
if constexpr (debug_flags::text_service) {
log::TagDebug(log_tag,
u"Calculate input method candidate window position: {}.",
- right_bottom.ToDebugString());
+ right_bottom);
}
input_method_context->SetCandidateWindowPosition(right_bottom);