* 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)
| 12256 | * If no arguments are given, it uses the current vim selection state. |
| 12257 | */ |
| 12258 | function updateCmSelection(cm, sel, mode) { |
| 12259 | var vim = cm.state.vim; |
| 12260 | sel = sel || vim.sel; |
| 12261 | var mode = mode || |
| 12262 | vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char'; |
| 12263 | var cmSel = makeCmSelection(cm, sel, mode); |
| 12264 | cm.setSelections(cmSel.ranges, cmSel.primary); |
| 12265 | updateFakeCursor(cm); |
| 12266 | } |
| 12267 | function makeCmSelection(cm, sel, mode, exclusive) { |
| 12268 | var head = copyCursor(sel.head); |
| 12269 | var anchor = copyCursor(sel.anchor); |
no test coverage detected