aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/TextHostControlService.cpp
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-11-16 15:43:20 +0800
committerYuqian Yang <crupest@crupest.life>2025-11-16 15:43:20 +0800
commit1ef4651c4002eb3a155bcd36fed1e5b6b63b1c80 (patch)
tree4c5158b3c0149c520cb25e7c89fbdc0f20bd72e5 /src/ui/controls/TextHostControlService.cpp
parentc350346c41cb779413389f26c5c8f4e9bd2a8141 (diff)
downloadcru-1ef4651c4002eb3a155bcd36fed1e5b6b63b1c80.tar.gz
cru-1ef4651c4002eb3a155bcd36fed1e5b6b63b1c80.tar.bz2
cru-1ef4651c4002eb3a155bcd36fed1e5b6b63b1c80.zip
Fix some part of WinWindow.
Diffstat (limited to 'src/ui/controls/TextHostControlService.cpp')
-rw-r--r--src/ui/controls/TextHostControlService.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ui/controls/TextHostControlService.cpp b/src/ui/controls/TextHostControlService.cpp
index b2fbd61d..06c1651f 100644
--- a/src/ui/controls/TextHostControlService.cpp
+++ b/src/ui/controls/TextHostControlService.cpp
@@ -273,7 +273,8 @@ void TextHostControlService::DeleteText(TextRange range,
range = range.Normalize();
if (!Utf8IsValidInsertPosition(this->text_.data(), this->text_.size(),
range.GetStart())) {
- CRU_LOG_TAG_ERROR("Invalid text delete start position {}.", range.GetStart());
+ CRU_LOG_TAG_ERROR("Invalid text delete start position {}.",
+ range.GetStart());
return;
}
if (!Utf8IsValidInsertPosition(this->text_.data(), this->text_.size(),
@@ -701,6 +702,7 @@ void TextHostControlService::OpenContextMenu(const Point& position,
ContextMenuItem items) {
CRU_LOG_TAG_DEBUG("Open context menu.");
auto menu = context_menu_->GetMenu();
+ menu->ClearItems();
if (items & ContextMenuItem::kSelectAll) {
menu->AddTextItem("Select All", [this] { this->SelectAll(); });
}
@@ -713,8 +715,8 @@ void TextHostControlService::OpenContextMenu(const Point& position,
if (items & ContextMenuItem::kPaste) {
menu->AddTextItem("Paste", [this] { this->Paste(); });
}
- context_menu_->SetPosition(position);
context_menu_->Show();
+ context_menu_->SetPosition(position);
}
} // namespace cru::ui::controls