* Clips cursor to ensure that line is within the buffer's range * If includeLineBreak is true, then allow cur.ch == lineLength.
(cm, cur, includeLineBreak)
| 1398 | * If includeLineBreak is true, then allow cur.ch == lineLength. |
| 1399 | */ |
| 1400 | function clipCursorToContent(cm, cur, includeLineBreak) { |
| 1401 | var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() ); |
| 1402 | var maxCh = lineLength(cm, line) - 1; |
| 1403 | maxCh = (includeLineBreak) ? maxCh + 1 : maxCh; |
| 1404 | var ch = Math.min(Math.max(0, cur.ch), maxCh); |
| 1405 | return { line: line, ch: ch }; |
| 1406 | } |
| 1407 | // Merge arguments in place, for overriding arguments. |
| 1408 | function mergeArgs(to, from) { |
| 1409 | for (var prop in from) { |
no test coverage detected