aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/TextControlService.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/controls/TextControlService.hpp')
-rw-r--r--src/ui/controls/TextControlService.hpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ui/controls/TextControlService.hpp b/src/ui/controls/TextControlService.hpp
index 93a48c44..1108a3b2 100644
--- a/src/ui/controls/TextControlService.hpp
+++ b/src/ui/controls/TextControlService.hpp
@@ -7,6 +7,7 @@
#include "cru/ui/Control.hpp"
#include "cru/ui/UiEvent.hpp"
#include "cru/ui/render/CanvasRenderObject.hpp"
+#include "cru/ui/render/ScrollRenderObject.hpp"
#include "cru/ui/render/TextRenderObject.hpp"
namespace cru::ui::controls {
@@ -140,7 +141,8 @@ class TextControlService : public Object {
log::TagDebug(log_tag, u"Text selection updated, range: {}, {}.", old_start,
new_end);
if (const auto scroll_render_object = this->GetScrollRenderObject()) {
- // TODO: Implement this.
+ const auto caret_rect = text_render_object->GetCaretRect();
+ scroll_render_object->ScrollToContain(caret_rect, Thickness{5.f});
}
}