(cm, idx)
| 3812 | no more valid positions. |
| 3813 | */ |
| 3814 | function nextChar(cm, idx) { |
| 3815 | if (idx.pos + idx.dir < 0 || idx.pos + idx.dir >= idx.line.length) { |
| 3816 | idx.ln += idx.dir; |
| 3817 | if (!isLine(cm, idx.ln)) { |
| 3818 | idx.line = null; |
| 3819 | idx.ln = null; |
| 3820 | idx.pos = null; |
| 3821 | return; |
| 3822 | } |
| 3823 | idx.line = cm.getLine(idx.ln); |
| 3824 | idx.pos = (idx.dir > 0) ? 0 : idx.line.length - 1; |
| 3825 | } |
| 3826 | else { |
| 3827 | idx.pos += idx.dir; |
| 3828 | } |
| 3829 | } |
| 3830 | |
| 3831 | /* |
| 3832 | Performs one iteration of traversal in forward direction |