MCPcopy Index your code
hub / github.com/witheve/Eve / repeatInsertModeChanges

Function repeatInsertModeChanges

src/codemirror.js:14363–14400  ·  view source on GitHub ↗
(cm, changes, repeat)

Source from the content-addressed store, hash-verified

14361 };
14362
14363 function repeatInsertModeChanges(cm, changes, repeat) {
14364 function keyHandler(binding) {
14365 if (typeof binding == 'string') {
14366 CodeMirror.commands[binding](cm);
14367 } else {
14368 binding(cm);
14369 }
14370 return true;
14371 }
14372 var head = cm.getCursor('head');
14373 var inVisualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock;
14374 if (inVisualBlock) {
14375 // Set up block selection again for repeating the changes.
14376 var vim = cm.state.vim;
14377 var lastSel = vim.lastSelection;
14378 var offset = getOffset(lastSel.anchor, lastSel.head);
14379 selectForInsert(cm, head, offset.line + 1);
14380 repeat = cm.listSelections().length;
14381 cm.setCursor(head);
14382 }
14383 for (var i = 0; i < repeat; i++) {
14384 if (inVisualBlock) {
14385 cm.setCursor(offsetCursor(head, i, 0));
14386 }
14387 for (var j = 0; j < changes.length; j++) {
14388 var change = changes[j];
14389 if (change instanceof InsertModeKey) {
14390 CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler);
14391 } else {
14392 var cur = cm.getCursor();
14393 cm.replaceRange(change, cur, cur);
14394 }
14395 }
14396 }
14397 if (inVisualBlock) {
14398 cm.setCursor(offsetCursor(head, 0, 1));
14399 }
14400 }
14401
14402 resetVimGlobalState();
14403 return vimApi;

Callers 2

executeMacroRegisterFunction · 0.85
repeatInsertFunction · 0.85

Calls 7

getOffsetFunction · 0.85
selectForInsertFunction · 0.85
offsetCursorFunction · 0.85
getCursorMethod · 0.80
listSelectionsMethod · 0.80
setCursorMethod · 0.80
replaceRangeMethod · 0.80

Tested by

no test coverage detected