(line, pos)
| 2881 | } |
| 2882 | |
| 2883 | function findWordAt(line, pos) { |
| 2884 | var start = pos.ch, end = pos.ch; |
| 2885 | if (line) { |
| 2886 | if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end; |
| 2887 | var startChar = line.charAt(start); |
| 2888 | var check = isWordChar(startChar) ? isWordChar |
| 2889 | : /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);} |
| 2890 | : function(ch) {return !/\s/.test(ch) && !isWordChar(ch);}; |
| 2891 | while (start > 0 && check(line.charAt(start - 1))) --start; |
| 2892 | while (end < line.length && check(line.charAt(end))) ++end; |
| 2893 | } |
| 2894 | return {from: Pos(pos.line, start), to: Pos(pos.line, end)}; |
| 2895 | } |
| 2896 | |
| 2897 | function selectLine(cm, line) { |
| 2898 | extendSelection(cm.doc, Pos(line, 0), clipPos(cm.doc, Pos(line + 1, 0))); |
no test coverage detected