(cm, oldCur, newCur)
| 547 | var tail = 0; |
| 548 | var buffer = new Array(size); |
| 549 | function add(cm, oldCur, newCur) { |
| 550 | var current = pointer % size; |
| 551 | var curMark = buffer[current]; |
| 552 | function useNextSlot(cursor) { |
| 553 | var next = ++pointer % size; |
| 554 | var trashMark = buffer[next]; |
| 555 | if (trashMark) { |
| 556 | trashMark.clear(); |
| 557 | } |
| 558 | buffer[next] = cm.setBookmark(cursor); |
| 559 | } |
| 560 | if (curMark) { |
| 561 | var markPos = curMark.find(); |
| 562 | // avoid recording redundant cursor position |
| 563 | if (markPos && !cursorEqual(markPos, oldCur)) { |
| 564 | useNextSlot(oldCur); |
| 565 | } |
| 566 | } else { |
| 567 | useNextSlot(oldCur); |
| 568 | } |
| 569 | useNextSlot(newCur); |
| 570 | head = pointer; |
| 571 | tail = pointer - size + 1; |
| 572 | if (tail < 0) { |
| 573 | tail = 0; |
| 574 | } |
| 575 | } |
| 576 | function move(cm, offset) { |
| 577 | pointer += offset; |
| 578 | if (pointer > head) { |
nothing calls this directly
no test coverage detected