mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add set_clipboard_context function and relevant plumbing. Use Option more consistantly (less unwraps) in textinput's selection handling.
This commit is contained in:
parent
52c2049f2a
commit
f86252a60b
5 changed files with 83 additions and 48 deletions
|
@ -50,14 +50,14 @@ fn test_textinput_get_sorted_selection() {
|
|||
let mut textinput = TextInput::new(Lines::Single, "abcdefg".to_owned(), DummyClipboardContext::new(""));
|
||||
textinput.adjust_horizontal(2, Selection::NotSelected);
|
||||
textinput.adjust_horizontal(2, Selection::Selected);
|
||||
let (begin, end) = textinput.get_sorted_selection();
|
||||
let (begin, end) = textinput.get_sorted_selection().unwrap();
|
||||
assert_eq!(begin.index, 2);
|
||||
assert_eq!(end.index, 4);
|
||||
|
||||
textinput.clear_selection();
|
||||
|
||||
textinput.adjust_horizontal(-2, Selection::Selected);
|
||||
let (begin, end) = textinput.get_sorted_selection();
|
||||
let (begin, end) = textinput.get_sorted_selection().unwrap();
|
||||
assert_eq!(begin.index, 2);
|
||||
assert_eq!(end.index, 4);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue