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

Function moveToCharacter

static/js/codemirror/keymap/vim.js:1715–1728  ·  view source on GitHub ↗
(cm, repeat, forward, character)

Source from the content-addressed store, hash-verified

1713 }
1714
1715 function moveToCharacter(cm, repeat, forward, character) {
1716 var cur = cm.getCursor();
1717 var start = cur.ch;
1718 var idx;
1719 for (var i = 0; i < repeat; i ++) {
1720 var line = cm.getLine(cur.line);
1721 idx = charIdxInLine(start, line, character, forward, true);
1722 if (idx == -1) {
1723 return cur;
1724 }
1725 start = idx;
1726 }
1727 return { line: cm.getCursor().line, ch: idx };
1728 }
1729
1730 function moveToColumn(cm, repeat) {
1731 // repeat is always >= 1, so repeat - 1 always corresponds

Callers 1

VimFunction · 0.85

Calls 1

charIdxInLineFunction · 0.85

Tested by

no test coverage detected