aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/TextHostControlService.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-12-26 23:41:02 +0800
committercrupest <crupest@outlook.com>2020-12-26 23:41:02 +0800
commit6523ba8e0f2830f3cd4434d8331882077be3f82c (patch)
treea09c4344c69e9b44efa6698e79fa2d6723bd59cb /src/ui/controls/TextHostControlService.cpp
parentacb7462be0b1d6b002a9e50a81b2b74fdc16a3b3 (diff)
downloadcru-6523ba8e0f2830f3cd4434d8331882077be3f82c.tar.gz
cru-6523ba8e0f2830f3cd4434d8331882077be3f82c.tar.bz2
cru-6523ba8e0f2830f3cd4434d8331882077be3f82c.zip
...
Diffstat (limited to 'src/ui/controls/TextHostControlService.cpp')
-rw-r--r--src/ui/controls/TextHostControlService.cpp16
1 files changed, 16 insertions, 0 deletions
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