MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / doReplace

Function doReplace

static/js/codemirror/keymap/vim.js:2458–2470  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2456 }
2457 var startPos = clipCursorToContent(cm, { line: lineStart, ch: 0 });
2458 function doReplace() {
2459 for (var cursor = cm.getSearchCursor(query, startPos);
2460 cursor.findNext() &&
2461 isInRange(cursor.from(), lineStart, lineEnd);) {
2462 var text = cm.getRange(cursor.from(), cursor.to());
2463 var newText = text.replace(query, replacePart);
2464 cursor.replace(newText);
2465 }
2466 var vim = getVimState(cm);
2467 if (vim.visualMode) {
2468 exitVisualMode(cm, vim);
2469 }
2470 }
2471 if (cm.compoundChange) {
2472 // Only exists in v2
2473 cm.compoundChange(doReplace);

Callers

nothing calls this directly

Calls 3

isInRangeFunction · 0.85
getVimStateFunction · 0.85
exitVisualModeFunction · 0.85

Tested by

no test coverage detected