aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/TextHostControlService.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/controls/TextHostControlService.cpp')
-rw-r--r--src/ui/controls/TextHostControlService.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ui/controls/TextHostControlService.cpp b/src/ui/controls/TextHostControlService.cpp
index 42153ffd..edfabb94 100644
--- a/src/ui/controls/TextHostControlService.cpp
+++ b/src/ui/controls/TextHostControlService.cpp
@@ -318,6 +318,10 @@ void TextHostControlService::SetSelection(TextRange selection,
}
}
+void TextHostControlService::SelectAll() {
+ this->SetSelection(TextRange{0, this->text_.size()});
+}
+
void TextHostControlService::ChangeSelectionEnd(Index new_end) {
auto selection = GetSelection();
selection.ChangeEnd(new_end);
@@ -482,6 +486,16 @@ void TextHostControlService::LoseFocusHandler(
void TextHostControlService::SetUpShortcuts() {
using platform::gui::KeyCode;
using platform::gui::KeyModifiers;
+ using platform::gui::kKeyModifierCommand;
+
+ shortcut_hub_.RegisterShortcut(u"Select All",
+ {KeyCode::A, kKeyModifierCommand}, [this] {
+ if (IsEnabled()) {
+ this->SelectAll();
+ return true;
+ }
+ return false;
+ });
shortcut_hub_.RegisterShortcut(u"Backspace", KeyCode::Backspace, [this] {
if (!IsEnabled()) return false;