(cm, pos, dir)
| 9000 | } |
| 9001 | |
| 9002 | function bySentence(cm, pos, dir) { |
| 9003 | var line = pos.line, ch = pos.ch; |
| 9004 | var text = cm.getLine(pos.line), sawWord = false; |
| 9005 | for (;;) { |
| 9006 | var next = text.charAt(ch + (dir < 0 ? -1 : 0)); |
| 9007 | if (!next) { // End/beginning of line reached |
| 9008 | if (line == (dir < 0 ? cm.firstLine() : cm.lastLine())) return Pos(line, ch); |
| 9009 | text = cm.getLine(line + dir); |
| 9010 | if (!/\S/.test(text)) return Pos(line, ch); |
| 9011 | line += dir; |
| 9012 | ch = dir < 0 ? text.length : 0; |
| 9013 | continue; |
| 9014 | } |
| 9015 | if (sawWord && /[!?.]/.test(next)) return Pos(line, ch + (dir > 0 ? 1 : 0)); |
| 9016 | if (!sawWord) sawWord = /\w/.test(next); |
| 9017 | ch += dir; |
| 9018 | } |
| 9019 | } |
| 9020 | |
| 9021 | function byExpr(cm, pos, dir) { |
| 9022 | var wrap; |
no test coverage detected