Skip to content

Commit

Permalink
Update the string splice transform logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mmacfadden committed Feb 4, 2022
1 parent c61725d commit 3b4ed65
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
Expand Up @@ -391,14 +391,21 @@ private[ot] object StringSpliceSpliceTF extends OperationTransformationFunction[
case FinishedBy =>
(
s.copy(deleteCount = s.deleteCount - c.deleteCount),
c.copy(deleteCount = 0, index = s.index + s.insertValue.length),
c.copy(deleteCount = 0, index = s.index + s.insertValue.length)
)

case EqualTo =>
(
s.copy(deleteCount = 0),
c.copy(index = c.index + s.insertValue.length, deleteCount = 0),
)
if (s.insertValue != c.insertValue) {
(
s,
c.copy(noOp = true)
)
} else {
(
s.copy(noOp = true),
c.copy(noOp = true)
)
}
}
}

Expand Down
@@ -0,0 +1,28 @@
{
"serverOpType": "StringSplice",
"clientOpType": "StringSplice",
"cases": [
{
"id": "S-PP-1",
"input": {
"serverOp": {"type": "StringSplice", "noOp": false, "index": 4, "deleteCount": 1, "insertValue": "X"},
"clientOp": {"type": "StringSplice", "noOp": false, "index": 4, "deleteCount": 1, "insertValue": "Y"}
},
"output": {
"serverOp": {"type": "StringSplice", "noOp": false, "index": 4, "deleteCount": 1, "insertValue": "X"},
"clientOp": {"type": "StringSplice", "noOp": true, "index": 4, "deleteCount": 1, "insertValue": "Y"}
}
},
{
"id": "S-PP-2",
"input": {
"serverOp": {"type": "StringSplice", "noOp": false, "index": 4, "deleteCount": 1, "insertValue": "X"},
"clientOp": {"type": "StringSplice", "noOp": false, "index": 4, "deleteCount": 1, "insertValue": "X"}
},
"output": {
"serverOp": {"type": "StringSplice", "noOp": true, "index": 4, "deleteCount": 1, "insertValue": "X"},
"clientOp": {"type": "StringSplice", "noOp": true, "index": 4, "deleteCount": 1, "insertValue": "X"}
}
}
]
}

0 comments on commit 3b4ed65

Please sign in to comment.