From 6523ba8e0f2830f3cd4434d8331882077be3f82c Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 26 Dec 2020 23:41:02 +0800 Subject: ... --- src/ui/controls/TextHostControlService.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/ui/controls/TextHostControlService.cpp') diff --git a/src/ui/controls/TextHostControlService.cpp b/src/ui/controls/TextHostControlService.cpp index 91ec53ff..4bfd6715 100644 --- a/src/ui/controls/TextHostControlService.cpp +++ b/src/ui/controls/TextHostControlService.cpp @@ -419,6 +419,14 @@ void TextHostControlService::SetUpShortcuts() { return true; }); + shortcut_hub_.RegisterShortcut( + u"CtrlLeft", {KeyCode::Left, KeyModifiers::ctrl}, [this] { + auto text = this->GetTextView(); + auto caret = this->GetCaretPosition(); + this->SetSelection(Utf16PreviousWord(text, caret)); + return true; + }); + shortcut_hub_.RegisterShortcut(u"Right", KeyCode::Right, [this] { auto text = this->GetTextView(); const auto caret = this->GetCaretPosition(); @@ -438,5 +446,13 @@ void TextHostControlService::SetUpShortcuts() { this->SetSelection(selection); return true; }); + + shortcut_hub_.RegisterShortcut( + u"CtrlRight", {KeyCode::Right, KeyModifiers::ctrl}, [this] { + auto text = this->GetTextView(); + auto caret = this->GetCaretPosition(); + this->SetSelection(Utf16NextWord(text, caret)); + return true; + }); } } // namespace cru::ui::controls -- cgit v1.2.3