Skip to content

Main content

List: List Deletion Cursor Shift Tool

Map one between-element cursor through a half-open deletion, collapsing cursors inside the removed run to its start.

Loading tool…

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

  1. Enter cursor, deletionStart, deletionEnd, length. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. 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 fieldMeaning and unitsAccepted input
cursorCursorRequired. Safe integer.
deletionStartDeletion StartRequired. Safe integer.
deletionEndDeletion EndRequired. Safe integer.
lengthLength, count, or code length under the stated domain and unit convention.Required. Safe integer.
Output fieldInterpretationReturned shape
resultResultRequired. Object.
result.cursorCursorCalculated result member: number.
result.newLengthNew LengthCalculated result member: number.
json
{
  "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

  1. Calculation and input contract: list/list-deletion-cursor-shift — tool.io

Similar or alternative tools