* Clips cursor to ensure that line is within the buffer's range * If includeLineBreak is true, then allow cur.ch == lineLength.
(cm, cur, includeLineBreak)
| 11964 | * If includeLineBreak is true, then allow cur.ch == lineLength. |
| 11965 | */ |
| 11966 | function clipCursorToContent(cm, cur, includeLineBreak) { |
| 11967 | var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() ); |
| 11968 | var maxCh = lineLength(cm, line) - 1; |
| 11969 | maxCh = (includeLineBreak) ? maxCh + 1 : maxCh; |
| 11970 | var ch = Math.min(Math.max(0, cur.ch), maxCh); |
| 11971 | return Pos(line, ch); |
| 11972 | } |
| 11973 | function copyArgs(args) { |
| 11974 | var ret = {}; |
| 11975 | for (var prop in args) { |
no test coverage detected