aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-10-28 17:56:30 +0800
committercrupest <crupest@outlook.com>2020-10-28 17:56:30 +0800
commitd3e49fa3b505cce12a60cb1a2711fd6b4427303b (patch)
tree285fc7f07e8e3691ced0254978ec103c57b3d831 /src
parent4e0a5338f15a247c33df863c4c619ffdb0a98aae (diff)
downloadcru-d3e49fa3b505cce12a60cb1a2711fd6b4427303b.tar.gz
cru-d3e49fa3b505cce12a60cb1a2711fd6b4427303b.tar.bz2
cru-d3e49fa3b505cce12a60cb1a2711fd6b4427303b.zip
...
Diffstat (limited to 'src')
-rw-r--r--src/ui/controls/TextControlService.hpp5
-rw-r--r--src/ui/render/TextRenderObject.cpp1
2 files changed, 5 insertions, 1 deletions
diff --git a/src/ui/controls/TextControlService.hpp b/src/ui/controls/TextControlService.hpp
index 376f9177..fe33f459 100644
--- a/src/ui/controls/TextControlService.hpp
+++ b/src/ui/controls/TextControlService.hpp
@@ -411,7 +411,10 @@ class TextControlService : public Object {
input_method_context_ =
GetUiApplication()->GetInputMethodManager()->GetContext(window);
input_method_context_->EnableIME();
- auto sync = [this](std::nullptr_t) { this->SyncTextRenderObject(); };
+ auto sync = [this](std::nullptr_t) {
+ this->SyncTextRenderObject();
+ ScrollToCaret();
+ };
input_method_context_->CompositionStartEvent()->AddHandler(
[this](std::nullptr_t) { this->DeleteSelectedText(); });
input_method_context_->CompositionEvent()->AddHandler(sync);
diff --git a/src/ui/render/TextRenderObject.cpp b/src/ui/render/TextRenderObject.cpp
index cecbe1f3..466c5084 100644
--- a/src/ui/render/TextRenderObject.cpp
+++ b/src/ui/render/TextRenderObject.cpp
@@ -43,6 +43,7 @@ std::u16string_view TextRenderObject::GetTextView() const {
void TextRenderObject::SetText(std::u16string new_text) {
text_layout_->SetText(std::move(new_text));
+ InvalidateLayout();
}
void TextRenderObject::SetBrush(