MCPcopy Create free account
hub / github.com/witheve/Eve / charIdxInLine

Function charIdxInLine

src/codemirror.js:12733–12752  ·  view source on GitHub ↗
(start, line, character, forward, includeChar)

Source from the content-addressed store, hash-verified

12731 }
12732
12733 function charIdxInLine(start, line, character, forward, includeChar) {
12734 // Search for char in line.
12735 // motion_options: {forward, includeChar}
12736 // If includeChar = true, include it too.
12737 // If forward = true, search forward, else search backwards.
12738 // If char is not found on this line, do nothing
12739 var idx;
12740 if (forward) {
12741 idx = line.indexOf(character, start + 1);
12742 if (idx != -1 && !includeChar) {
12743 idx -= 1;
12744 }
12745 } else {
12746 idx = line.lastIndexOf(character, start - 1);
12747 if (idx != -1 && !includeChar) {
12748 idx += 1;
12749 }
12750 }
12751 return idx;
12752 }
12753
12754 function findParagraph(cm, head, repeat, dir, inclusive) {
12755 var line = head.line;

Callers 1

moveToCharacterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected