Fix 'invalid insertion' panic when following

Wait for the necessary buffer operations to arrive before attempting to
set selections and scroll top.
This commit is contained in:
Max Brunsfeld 2023-04-18 16:13:18 -07:00
parent a8b3826955
commit bd7d50f339
6 changed files with 229 additions and 167 deletions

View file

@ -1331,15 +1331,15 @@ impl Buffer {
}
}
pub fn wait_for_anchors<'a>(
pub fn wait_for_anchors(
&mut self,
anchors: impl IntoIterator<Item = &'a Anchor>,
anchors: impl IntoIterator<Item = Anchor>,
) -> impl 'static + Future<Output = Result<()>> {
let mut futures = Vec::new();
for anchor in anchors {
if !self.version.observed(anchor.timestamp)
&& *anchor != Anchor::MAX
&& *anchor != Anchor::MIN
&& anchor != Anchor::MAX
&& anchor != Anchor::MIN
{
let (tx, rx) = oneshot::channel();
self.edit_id_resolvers