From dfcf9fc6a544f61025cdba14ed917cfb1f001429 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Sun, 11 Jan 2015 00:26:39 -0800 Subject: [PATCH] A simple implementation of move_text. This should probably be replaced by a more efficient implementation in the future, as this version will be slow and require large allocations when moving large pieces of text. But let's wait and see if it's a problem in practice first. --- src/buffer/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/buffer/mod.rs b/src/buffer/mod.rs index 6d8c2b0..5ff0183 100644 --- a/src/buffer/mod.rs +++ b/src/buffer/mod.rs @@ -143,8 +143,11 @@ impl Buffer { } // All other cases else { - // TODO - return; + // TODO: a more efficient implementation that directly + // manipulates the node tree. + let s = self.string_from_range(pos_a, pos_b); + self.remove_text(pos_a, pos_b); + self.insert_text(s.as_slice(), pos_to); } }