(pos, linelen)
| 2284 | return clipToLen(pos, getLine(doc, pos.line).text.length); |
| 2285 | } |
| 2286 | function clipToLen(pos, linelen) { |
| 2287 | var ch = pos.ch; |
| 2288 | if (ch == null || ch > linelen) return Pos(pos.line, linelen); |
| 2289 | else if (ch < 0) return Pos(pos.line, 0); |
| 2290 | else return pos; |
| 2291 | } |
| 2292 | function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;} |
| 2293 | |
| 2294 | // If shift is held, this will move the selection anchor. Otherwise, |
no test coverage detected