docs: function rebaseHistArray(array, from, to, diff) {
    for (let i = 0; i < array.length; ++i) {
      let sub = array[i], ok = true
      if (sub.ranges) {
        if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true }
        for (let j = 0; j < sub.ranges.length; j++) {
          rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff)
          rebaseHistSelSingle(sub.ranges[j].head, from, to, diff)
        }
        continue
      }
      for (let j = 0; j < sub.changes.length; ++j) {
        let cur = sub.changes[j]
        if (to < cur.from.line) {
          cur.from = Pos(cur.from.line + diff, cur.from.ch)
          cur.to = Pos(cur.to.line + diff, cur.to.ch)
        } else if (from <= cur.to.line) {
          ok = false
          break
        }
      }
      if (!ok) {
        array.splice(0, i + 1)
        i = 0
      }
    }
  }