(from, to)
| 3210 | // Used to position the cursor after an undo/redo by finding the |
| 3211 | // last edited character. |
| 3212 | function editEnd(from, to) { |
| 3213 | if (!to) return 0; |
| 3214 | if (!from) return to.length; |
| 3215 | for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j) |
| 3216 | if (from.charAt(i) != to.charAt(j)) break; |
| 3217 | return j + 1; |
| 3218 | } |
| 3219 | |
| 3220 | function indexOf(collection, elt) { |
| 3221 | if (collection.indexOf) return collection.indexOf(elt); |