(from, to)
| 3010 | // Used to position the cursor after an undo/redo by finding the |
| 3011 | // last edited character. |
| 3012 | function editEnd(from, to) { |
| 3013 | if (!to) return 0; |
| 3014 | if (!from) return to.length; |
| 3015 | for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j) |
| 3016 | if (from.charAt(i) != to.charAt(j)) break; |
| 3017 | return j + 1; |
| 3018 | } |
| 3019 | |
| 3020 | function indexOf(collection, elt) { |
| 3021 | if (collection.indexOf) return collection.indexOf(elt); |