mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Take selection direction into account when setting selection
This commit is contained in:
parent
7da28b7ca6
commit
8e5d5a45ef
1 changed files with 11 additions and 2 deletions
|
@ -651,8 +651,17 @@ impl<T: ClipboardProvider> TextInput<T> {
|
||||||
start = end;
|
start = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.selection_begin = Some(self.get_text_point_for_absolute_point(start));
|
match self.selection_direction {
|
||||||
self.edit_point = self.get_text_point_for_absolute_point(end);
|
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();
|
self.assert_ok_selection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue