MCPcopy
hub / github.com/witheve/Eve / byParagraph

Function byParagraph

src/codemirror.js:8987–9000  ·  view source on GitHub ↗
(cm, pos, dir)

Source from the content-addressed store, hash-verified

8985 }
8986
8987 function byParagraph(cm, pos, dir) {
8988 var no = pos.line, line = cm.getLine(no);
8989 var sawText = /\S/.test(dir < 0 ? line.slice(0, pos.ch) : line.slice(pos.ch));
8990 var fst = cm.firstLine(), lst = cm.lastLine();
8991 for (;;) {
8992 no += dir;
8993 if (no < fst || no > lst)
8994 return cm.clipPos(Pos(no - dir, dir < 0 ? 0 : null));
8995 line = cm.getLine(no);
8996 var hasText = /\S/.test(line);
8997 if (hasText) sawText = true;
8998 else if (sawText) return Pos(no, 0);
8999 }
9000 }
9001
9002 function bySentence(cm, pos, dir) {
9003 var line = pos.line, ch = pos.ch;

Callers

nothing calls this directly

Calls 4

getLineMethod · 0.80
firstLineMethod · 0.80
lastLineMethod · 0.80
testMethod · 0.45

Tested by

no test coverage detected