Description
Keep cursors at or before deletionStart, collapse those through deletionEnd to deletionStart, and shift later cursors left by the deleted length.
A splice replaces part of a list and changes later positions. Cursor affinity defines which side of inserted content a boundary follows when the splice covers it.
Keep cursors at or before deletionStart, collapse those through deletionEnd to deletionStart, and shift later cursors left by the deleted length.
When to use this tool
Use List: List Deletion Cursor Shift when you need a splice length, gap-fill, or cursor-mapping calculation.
How to use the tool and how it works
- Enter cursor, deletionStart, deletionEnd, length. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read result. Expand result to inspect the returned fields.
Keep cursors at or before deletionStart, collapse those through deletionEnd to deletionStart, and shift later cursors left by the deleted length. Return the shortened length.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| cursor | Cursor | Required. Safe integer. |
| deletionStart | Deletion Start | Required. Safe integer. |
| deletionEnd | Deletion End | Required. Safe integer. |
| length | Length, count, or code length under the stated domain and unit convention. | Required. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Result | Required. Object. |
| result.cursor | Cursor | Calculated result member: number. |
| result.newLength | New Length | Calculated result member: number. |
{
"input": {
"cursor": 3,
"deletionStart": 2,
"deletionEnd": 4,
"length": 5
},
"output": {
"result": {
"cursor": 2,
"newLength": 3
}
}
} Limitations and assumptions
- The deletion range is half open, while a cursor at its end collapses to its start; values are not removed.
- Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Check the actual collection API's deletion clamping and cursor semantics before applying an edit.
References
Similar or alternative tools
- List: List Insertion Cursor Shift
Shift cursor by insertedCount when it lies after insertionIndex or equals it with after affinity.
- List Delete Selected Index Map
Return -1 and removed true for selected deletion; otherwise subtract the number of deletions before selected.