* Updates the CodeMirror selection to match the provided vim selection. * If no arguments are given, it uses the current vim selection state.
(cm, sel, mode)
| 3201 | * If no arguments are given, it uses the current vim selection state. |
| 3202 | */ |
| 3203 | function updateCmSelection(cm, sel, mode) { |
| 3204 | var vim = cm.state.vim; |
| 3205 | sel = sel || vim.sel; |
| 3206 | var mode = mode || |
| 3207 | vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char'; |
| 3208 | var cmSel = makeCmSelection(cm, sel, mode); |
| 3209 | cm.setSelections(cmSel.ranges, cmSel.primary); |
| 3210 | updateFakeCursor(cm); |
| 3211 | } |
| 3212 | function makeCmSelection(cm, sel, mode, exclusive) { |
| 3213 | var head = copyCursor(sel.head); |
| 3214 | var anchor = copyCursor(sel.anchor); |
no test coverage detected