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.
This commit is contained in:
parent
8a51a796ce
commit
dfcf9fc6a5
|
@ -143,8 +143,11 @@ impl Buffer {
|
||||||
}
|
}
|
||||||
// All other cases
|
// All other cases
|
||||||
else {
|
else {
|
||||||
// TODO
|
// TODO: a more efficient implementation that directly
|
||||||
return;
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user