(cm, cHar, motion_options)
| 163 | } |
| 164 | |
| 165 | function charIdxInLine(cm, cHar, motion_options) { |
| 166 | // Search for cHar in line. |
| 167 | // motion_options: {forward, inclusive} |
| 168 | // If inclusive = true, include it too. |
| 169 | // If forward = true, search forward, else search backwards. |
| 170 | // If char is not found on this line, do nothing |
| 171 | var cur = cm.getCursor(), line = cm.getLine(cur.line), idx; |
| 172 | var ch = toLetter(cHar), mo = motion_options; |
| 173 | if (mo.forward) { |
| 174 | idx = line.indexOf(ch, cur.ch + 1); |
| 175 | if (idx != -1 && mo.inclusive) idx += 1; |
| 176 | } else { |
| 177 | idx = line.lastIndexOf(ch, cur.ch); |
| 178 | if (idx != -1 && !mo.inclusive) idx += 1; |
| 179 | } |
| 180 | return idx; |
| 181 | } |
| 182 | |
| 183 | function moveTillChar(cm, cHar, motion_options) { |
| 184 | // Move to cHar in line, as found by charIdxInLine. |
no test coverage detected