(line, pos)
| 2572 | } |
| 2573 | |
| 2574 | function findWordAt(line, pos) { |
| 2575 | var start = pos.ch, end = pos.ch; |
| 2576 | if (line) { |
| 2577 | if (pos.after === false || end == line.length) --start; else ++end; |
| 2578 | var startChar = line.charAt(start); |
| 2579 | var check = isWordChar(startChar) ? isWordChar : |
| 2580 | /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);} : |
| 2581 | function(ch) {return !/\s/.test(ch) && !isWordChar(ch);}; |
| 2582 | while (start > 0 && check(line.charAt(start - 1))) --start; |
| 2583 | while (end < line.length && check(line.charAt(end))) ++end; |
| 2584 | } |
| 2585 | return {from: Pos(pos.line, start), to: Pos(pos.line, end)}; |
| 2586 | } |
| 2587 | |
| 2588 | function selectLine(cm, line) { |
| 2589 | extendSelection(cm.doc, Pos(line, 0), clipPos(cm.doc, Pos(line + 1, 0))); |
no test coverage detected