diff options
author | 2022-12-25 11:51:40 -0600 | |
---|---|---|
committer | 2022-12-25 12:24:29 -0600 | |
commit | 280ffd26b76170d36e0272cf1a5d8ad66e88ddb1 (patch) | |
tree | 2bd823d1e04b4f79d523e28acea3e6038d6ae8c9 /native/src/widget/text_input.rs | |
parent | a6d0d5773f0561a841a84b538523cbd97e91eccd (diff) | |
download | iced-280ffd26b76170d36e0272cf1a5d8ad66e88ddb1.tar.gz iced-280ffd26b76170d36e0272cf1a5d8ad66e88ddb1.tar.bz2 iced-280ffd26b76170d36e0272cf1a5d8ad66e88ddb1.zip |
TextInput: SHIFT+Left Click to Select
Diffstat (limited to 'native/src/widget/text_input.rs')
-rw-r--r-- | native/src/widget/text_input.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index 05b47ff9..8b4514e3 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -454,9 +454,17 @@ where ) } else { None - }; + } + .unwrap_or(0); - state.cursor.move_to(position.unwrap_or(0)); + if state.keyboard_modifiers.shift() { + state.cursor.select_range( + state.cursor.start(value), + position, + ); + } else { + state.cursor.move_to(position); + } state.is_dragging = true; } click::Kind::Double => { |