summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2020-03-31 17:56:19 +0200
committerLibravatar GitHub <noreply@github.com>2020-03-31 17:56:19 +0200
commit3bf938f65fcaa5c954015f6d016b859f1d25152b (patch)
treebc694bdf3fa56e08fc8565a175abc91e8502e3ee /native
parente79e832092385346beec47f63e40f24800c535f8 (diff)
parent4ca54836a8917c0635fa28660eeeeb21de9f905d (diff)
downloadiced-3bf938f65fcaa5c954015f6d016b859f1d25152b.tar.gz
iced-3bf938f65fcaa5c954015f6d016b859f1d25152b.tar.bz2
iced-3bf938f65fcaa5c954015f6d016b859f1d25152b.zip
Merge pull request #249 from michael-swan/master
Add Ctrl+Backspace text field behaviour
Diffstat (limited to 'native')
-rw-r--r--native/src/widget/text_input.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs
index 3697ce09..b4ba5afa 100644
--- a/native/src/widget/text_input.rs
+++ b/native/src/widget/text_input.rs
@@ -338,6 +338,17 @@ where
}
}
keyboard::KeyCode::Backspace => {
+ if platform::is_jump_modifier_pressed(modifiers)
+ && self.state.cursor.selection().is_none()
+ {
+ if self.is_secure {
+ let cursor_pos = self.state.cursor.end(&self.value);
+ self.state.cursor.select_range(0, cursor_pos);
+ } else {
+ self.state.cursor.select_left_by_words(&self.value);
+ }
+ }
+
let mut editor =
Editor::new(&mut self.value, &mut self.state.cursor);