mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-30 13:04:13 +00:00
define shared iters
This commit is contained in:
parent
a445c4c6a2
commit
4c572fada6
@ -104,13 +104,17 @@ fn find(
|
|||||||
// Init matches holder
|
// Init matches holder
|
||||||
let mut result = Vec::new();
|
let mut result = Vec::new();
|
||||||
|
|
||||||
|
// Get iters
|
||||||
|
let buffer_start = buffer.start_iter();
|
||||||
|
let buffer_end = buffer.end_iter();
|
||||||
|
|
||||||
// Cleanup previous search highlights
|
// Cleanup previous search highlights
|
||||||
buffer.remove_tag(&tag.current, &buffer.start_iter(), &buffer.end_iter());
|
buffer.remove_tag(&tag.current, &buffer_start, &buffer_end);
|
||||||
buffer.remove_tag(&tag.found, &buffer.start_iter(), &buffer.end_iter());
|
buffer.remove_tag(&tag.found, &buffer_start, &buffer_end);
|
||||||
|
|
||||||
// Begin new search
|
// Begin new search
|
||||||
let mut next = buffer.start_iter();
|
let mut next = buffer_start;
|
||||||
while let Some((start, end)) = next.forward_search(
|
while let Some((match_start, match_end)) = next.forward_search(
|
||||||
subject,
|
subject,
|
||||||
match is_match_case {
|
match is_match_case {
|
||||||
true => TextSearchFlags::TEXT_ONLY,
|
true => TextSearchFlags::TEXT_ONLY,
|
||||||
@ -118,9 +122,9 @@ fn find(
|
|||||||
},
|
},
|
||||||
None, // unlimited
|
None, // unlimited
|
||||||
) {
|
) {
|
||||||
buffer.apply_tag(&tag.found, &start, &end);
|
buffer.apply_tag(&tag.found, &match_start, &match_end);
|
||||||
next = end;
|
next = match_end;
|
||||||
result.push((start, end));
|
result.push((match_start, match_end));
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user