(cm)
| 665 | }; |
| 666 | |
| 667 | function maybeInitVimState(cm) { |
| 668 | if (!cm.state.vim) { |
| 669 | // Store instance state in the CodeMirror object. |
| 670 | cm.state.vim = { |
| 671 | inputState: new InputState(), |
| 672 | // Vim's input state that triggered the last edit, used to repeat |
| 673 | // motions and operators with '.'. |
| 674 | lastEditInputState: undefined, |
| 675 | // Vim's action command before the last edit, used to repeat actions |
| 676 | // with '.' and insert mode repeat. |
| 677 | lastEditActionCommand: undefined, |
| 678 | // When using jk for navigation, if you move from a longer line to a |
| 679 | // shorter line, the cursor may clip to the end of the shorter line. |
| 680 | // If j is pressed again and cursor goes to the next line, the |
| 681 | // cursor should go back to its horizontal position on the longer |
| 682 | // line if it can. This is to keep track of the horizontal position. |
| 683 | lastHPos: -1, |
| 684 | // Doing the same with screen-position for gj/gk |
| 685 | lastHSPos: -1, |
| 686 | // The last motion command run. Cleared if a non-motion command gets |
| 687 | // executed in between. |
| 688 | lastMotion: null, |
| 689 | marks: {}, |
| 690 | // Mark for rendering fake cursor for visual mode. |
| 691 | fakeCursor: null, |
| 692 | insertMode: false, |
| 693 | // Repeat count for changes made in insert mode, triggered by key |
| 694 | // sequences like 3,i. Only exists when insertMode is true. |
| 695 | insertModeRepeat: undefined, |
| 696 | visualMode: false, |
| 697 | // If we are in visual line mode. No effect if visualMode is false. |
| 698 | visualLine: false, |
| 699 | visualBlock: false, |
| 700 | lastSelection: null, |
| 701 | lastPastedText: null, |
| 702 | sel: {}, |
| 703 | // Buffer-local/window-local values of vim options. |
| 704 | options: {} |
| 705 | }; |
| 706 | } |
| 707 | return cm.state.vim; |
| 708 | } |
| 709 | var vimGlobalState; |
| 710 | function resetVimGlobalState() { |
| 711 | vimGlobalState = { |
no outgoing calls
no test coverage detected