mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
Merge pull request #728 from AppFlowy-IO/fix/transform-operation
Fix: transform error for path
This commit is contained in:
commit
ddb2cb7d66
@ -128,6 +128,8 @@ Path transformPath(Path preInsertPath, Path b, [int delta = 1]) {
|
||||
final bAtIndex = b[preInsertPath.length - 1];
|
||||
if (preInsertLast <= bAtIndex) {
|
||||
prefix.add(bAtIndex + delta);
|
||||
} else {
|
||||
prefix.add(bAtIndex);
|
||||
}
|
||||
prefix.addAll(suffix);
|
||||
return prefix;
|
||||
|
@ -19,6 +19,7 @@ void main() {
|
||||
test("transform path not changed", () {
|
||||
expect(transformPath([0, 1, 2], [0, 0, 7, 8, 9]), [0, 0, 7, 8, 9]);
|
||||
expect(transformPath([0, 1, 2], [0, 1]), [0, 1]);
|
||||
expect(transformPath([1, 1], [1, 0]), [1, 0]);
|
||||
});
|
||||
test("transform path delta", () {
|
||||
expect(transformPath([0, 1], [0, 1], 5), [0, 6]);
|
||||
|
Loading…
Reference in New Issue
Block a user