diff options
author | Connor Brewster <connor.brewster@eagles.oc.edu> | 2016-07-06 16:14:32 -0600 |
---|---|---|
committer | Connor Brewster <connor.brewster@eagles.oc.edu> | 2016-07-06 16:14:32 -0600 |
commit | 8e5d5a45efb5211420e75d075fe427021542cada (patch) | |
tree | db36ef26abc2bfa9b0253ed85743e17db8658630 /components/script/textinput.rs | |
parent | 7da28b7ca63c7b4538aa1b81b7ad1182415c32f2 (diff) | |
download | servo-8e5d5a45efb5211420e75d075fe427021542cada.tar.gz servo-8e5d5a45efb5211420e75d075fe427021542cada.zip |
Take selection direction into account when setting selection
Diffstat (limited to 'components/script/textinput.rs')
-rw-r--r-- | components/script/textinput.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/components/script/textinput.rs b/components/script/textinput.rs index 871af9637c0..5beee247f96 100644 --- a/components/script/textinput.rs +++ b/components/script/textinput.rs @@ -651,8 +651,17 @@ impl<T: ClipboardProvider> TextInput<T> { start = end; } - self.selection_begin = Some(self.get_text_point_for_absolute_point(start)); - self.edit_point = self.get_text_point_for_absolute_point(end); + match self.selection_direction { + SelectionDirection::None | + SelectionDirection::Forward => { + self.selection_begin = Some(self.get_text_point_for_absolute_point(start)); + self.edit_point = self.get_text_point_for_absolute_point(end); + }, + SelectionDirection::Backward => { + self.selection_begin = Some(self.get_text_point_for_absolute_point(end)); + self.edit_point = self.get_text_point_for_absolute_point(start); + } + } self.assert_ok_selection(); } |