Take selection direction into account when setting selection

This commit is contained in:
Connor Brewster 2016-07-06 16:14:32 -06:00
parent 7da28b7ca6
commit 8e5d5a45ef

View file

@ -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();
}