()
| 107 | } |
| 108 | |
| 109 | function replayLastChange(): void { |
| 110 | const change = persistentRef.current.lastChange |
| 111 | if (!change) return |
| 112 | |
| 113 | const cursor = Cursor.fromText(props.value, props.columns, textInput.offset) |
| 114 | const ctx = createOperatorContext(cursor, true) |
| 115 | |
| 116 | switch (change.type) { |
| 117 | case 'insert': |
| 118 | if (change.text) { |
| 119 | const newCursor = cursor.insert(change.text) |
| 120 | props.onChange(newCursor.text) |
| 121 | textInput.setOffset(newCursor.offset) |
| 122 | } |
| 123 | break |
| 124 | |
| 125 | case 'x': |
| 126 | executeX(change.count, ctx) |
| 127 | break |
| 128 | |
| 129 | case 'replace': |
| 130 | executeReplace(change.char, change.count, ctx) |
| 131 | break |
| 132 | |
| 133 | case 'toggleCase': |
| 134 | executeToggleCase(change.count, ctx) |
| 135 | break |
| 136 | |
| 137 | case 'indent': |
| 138 | executeIndent(change.dir, change.count, ctx) |
| 139 | break |
| 140 | |
| 141 | case 'join': |
| 142 | executeJoin(change.count, ctx) |
| 143 | break |
| 144 | |
| 145 | case 'openLine': |
| 146 | executeOpenLine(change.direction, ctx) |
| 147 | break |
| 148 | |
| 149 | case 'operator': |
| 150 | executeOperatorMotion(change.op, change.motion, change.count, ctx) |
| 151 | break |
| 152 | |
| 153 | case 'operatorFind': |
| 154 | executeOperatorFind( |
| 155 | change.op, |
| 156 | change.find, |
| 157 | change.char, |
| 158 | change.count, |
| 159 | ctx, |
| 160 | ) |
| 161 | break |
| 162 | |
| 163 | case 'operatorTextObj': |
| 164 | executeOperatorTextObj( |
| 165 | change.op, |
| 166 | change.scope, |
nothing calls this directly
no test coverage detected