mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #10182 - mbrubeck:delete_char, r=jdm
Fix delete_char when selection range is empty An empty selection range should be treated the same as no selection. Fixes browserhtml/browserhtml#930. r? @jdm <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10182) <!-- Reviewable:end -->
This commit is contained in:
commit
db95de6e58
2 changed files with 9 additions and 2 deletions
|
@ -150,6 +150,13 @@ fn test_textinput_delete_char() {
|
|||
textinput.delete_char(Direction::Forward);
|
||||
// Not splitting surrogate pairs.
|
||||
assert_eq!(textinput.get_content(), "ab");
|
||||
|
||||
let mut textinput = text_input(Lines::Single, "abcdefg");
|
||||
textinput.adjust_horizontal(2, Selection::NotSelected);
|
||||
// Set an empty selection range.
|
||||
textinput.selection_begin = Some(textinput.edit_point);
|
||||
textinput.delete_char(Direction::Backward);
|
||||
assert_eq!(textinput.get_content(), "acdefg");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue