Skip to content
Snippets Groups Projects
Commit c78d76c8 authored by Yunchi Luo's avatar Yunchi Luo
Browse files

[vim] Visual mode rewrite

I'm rewriting the way that visual mode is written to:
1. Fix some tricky bugs, like https://github.com/codemirror/CodeMirror/issues/2913, and a couple I uncovered while doing this. (Unit tests updated)
2. Significantly simplify blockwise visual mode

The core of the changes here is that I'm creating a vim selection model. The selection model consists of

```
vim.sel.head
vim.sel.anchor
vim.visualMode
vim.visualLine
vim.visualBlock
```

I'm creating a 2-way binding between the vim and codemirror selection models. All motions now rely only on the vim selection model. Operators and actions still rely on the codemirror selection model, since they operate directly on the text.

Sorry for the gigantic change but I couldn't make it any smaller and still pass all the tests... I'm planning to delete `getSelectedAreaRange`, `getLastSelectedAreaRange`, and `selectBlock` in future changes as they are obsolete now that vim keeps its own selection model.

An added bonus here is that visual line mode now has a cursor that can be moved.
parent 4bce5342
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment