(span:Span, change:Change, action?:FormatAction)
| 622 | } |
| 623 | |
| 624 | function formattingChange(span:Span, change:Change, action?:FormatAction) { |
| 625 | let editor = span.editor; |
| 626 | let loc = span.find(); |
| 627 | if(!loc) return; |
| 628 | // Cut the changed range out of a span |
| 629 | if(action == "split") { |
| 630 | let final = change.final; |
| 631 | editor.markSpan(loc.from, change.from, span.source); |
| 632 | // If the change is within the right edge of the span, recreate the remaining segment |
| 633 | if(comparePositions(final, loc.to) === -1) { |
| 634 | editor.markSpan(final, loc.to, span.source); |
| 635 | } |
| 636 | span.clear(); |
| 637 | |
| 638 | } else if(!action) { |
| 639 | // If we're at the end of the span, expand it to include the change |
| 640 | if(samePosition(loc.to, change.from)) { |
| 641 | span.clear(); |
| 642 | editor.markSpan(loc.from, change.final, span.source); |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | |
| 647 | function ctrlify(keymap) { |
| 648 | let finalKeymap = {}; |
nothing calls this directly
no test coverage detected