MCPcopy Index your code
hub / github.com/VSCodeVim/Vim / rerunRecordedState

Method rerunRecordedState

src/mode/modeHandler.ts:1142–1204  ·  view source on GitHub ↗
(transformation: Dot)

Source from the content-addressed store, hash-verified

1140 }
1141
1142 public async rerunRecordedState(transformation: Dot): Promise<void> {
1143 let recordedState = transformation.recordedState.clone();
1144 const actions = [...recordedState.actionsRun];
1145
1146 this.vimState.dotCommandStatus = DotCommandStatus.Executing;
1147
1148 // If a previous visual selection exists, store it for use in replay of some commands
1149 if (this.vimState.lastVisualSelection) {
1150 this.vimState.dotCommandPreviousVisualSelection = new vscode.Selection(
1151 this.vimState.lastVisualSelection.start,
1152 this.vimState.lastVisualSelection.end,
1153 );
1154 }
1155
1156 let replayMode = null;
1157 if (actions[0] instanceof Insert) {
1158 replayMode = ReplayMode.Insert;
1159 } else if (actions[0] instanceof ReplaceCharacter) {
1160 replayMode = ReplayMode.Replace;
1161 } else if (actions[0] instanceof CommandRegister) {
1162 // Increment numbered registers "1 to "9.
1163 const keyPressed = Number(actions[0].keysPressed[1]);
1164 if (!isNaN(keyPressed) && keyPressed > 0 && keyPressed < 9) {
1165 actions[0].keysPressed[1] = String(keyPressed + 1);
1166 }
1167 }
1168 for (let j = 0; j < transformation.count; j++) {
1169 recordedState = new RecordedState();
1170 this.vimState.recordedState = recordedState;
1171 for (const [i, action] of actions.entries()) {
1172 if (
1173 replayMode === ReplayMode.Insert &&
1174 !(j === transformation.count - 1 && i === actions.length - 1) &&
1175 action instanceof ExitInsertMode
1176 ) {
1177 continue;
1178 }
1179 recordedState.actionsRun = actions.slice(0, i + 1);
1180 await this.runAction(recordedState, action);
1181
1182 if (this.lastMovementFailed) {
1183 break;
1184 }
1185
1186 this.updateView();
1187 if (
1188 replayMode === ReplayMode.Replace &&
1189 !(j === transformation.count - 1 && i === actions.length - 1)
1190 ) {
1191 this.vimState.cursorStopPosition = this.vimState.cursorStartPosition = new Position(
1192 this.vimState.cursorStopPosition.line,
1193 this.vimState.cursorStopPosition.character + 1,
1194 );
1195 }
1196 }
1197 }
1198 let combinedActions: IBaseAction[] = [];
1199 for (let i = 0; i < transformation.count; i++) {

Callers

nothing calls this directly

Calls 5

runActionMethod · 0.95
updateViewMethod · 0.95
cloneMethod · 0.80
entriesMethod · 0.80
concatMethod · 0.45

Tested by

no test coverage detected