Fixed find_till_char and find_char commands.

They worked correctly when extending, but not for normal cursor
movement.
imgbot
Nathan Vegdahl 3 years ago
parent 8f43dc4039
commit 20723495d3

@ -652,8 +652,13 @@ where
let text = doc.text().slice(..); let text = doc.text().slice(..);
let selection = doc.selection(view.id).clone().transform(|range| { let selection = doc.selection(view.id).clone().transform(|range| {
search_fn(text, ch, range.head, count, inclusive) search_fn(text, ch, range.head, count, inclusive).map_or(range, |pos| {
.map_or(range, |pos| range.put(text, pos, extend)) if extend {
range.put(text, pos, true)
} else {
range.put(text, pos.saturating_sub(1), false)
}
})
}); });
doc.set_selection(view.id, selection); doc.set_selection(view.id, selection);
}) })

Loading…
Cancel
Save