From 8e5d5a45efb5211420e75d075fe427021542cada Mon Sep 17 00:00:00 2001 From: Connor Brewster Date: Wed, 6 Jul 2016 16:14:32 -0600 Subject: Take selection direction into account when setting selection --- components/script/textinput.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'components/script/textinput.rs') 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 TextInput { 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(); } -- cgit v1.2.3