mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Fix a range-respecting bug in iter_indivisible_pieces_for_range.
This commit is contained in:
parent
1e7c49a9c6
commit
538fc9e73f
1 changed files with 4 additions and 4 deletions
|
@ -124,8 +124,7 @@ impl TextRun : TextRunMethods {
|
|||
let clump = MutableRange(range.begin(), 0);
|
||||
loop {
|
||||
// find next non-whitespace byte index, then clump all whitespace before it.
|
||||
if clump.end() == range.end() { break }
|
||||
match str::find_from(self.text, clump.begin(), |c| !char::is_whitespace(c)) {
|
||||
match str::find_between(self.text, clump.begin(), range.end(), |c| !char::is_whitespace(c)) {
|
||||
Some(nonws_char_offset) => {
|
||||
clump.extend_to(nonws_char_offset);
|
||||
if !f(clump.as_immutable()) { break }
|
||||
|
@ -136,13 +135,13 @@ impl TextRun : TextRunMethods {
|
|||
if clump.end() < range.end() {
|
||||
clump.extend_to(range.end());
|
||||
f(clump.as_immutable());
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// find next whitespace byte index, then clump all non-whitespace before it.
|
||||
if clump.end() == range.end() { break }
|
||||
match str::find_from(self.text, clump.begin(), |c| char::is_whitespace(c)) {
|
||||
match str::find_between(self.text, clump.begin(), range.end(), |c| char::is_whitespace(c)) {
|
||||
Some(ws_char_offset) => {
|
||||
clump.extend_to(ws_char_offset);
|
||||
if !f(clump.as_immutable()) { break }
|
||||
|
@ -153,6 +152,7 @@ impl TextRun : TextRunMethods {
|
|||
if clump.end() < range.end() {
|
||||
clump.extend_to(range.end());
|
||||
f(clump.as_immutable());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue