replit / codemirror-vim

Vim keybindings for CM6
https://www.npmjs.com/package/@replit/codemirror-vim
MIT License
268 stars 27 forks source link

Could the cursor use blinking rate from `drawSelection`? #140

Closed krassowski closed 8 months ago

krassowski commented 10 months ago

Currently the cursor blinking rate is hard-coded:

https://github.com/replit/codemirror-vim/blob/2f871797743a46628155477bae18f2f3f88a3c44/src/block-cursor.ts#L65-L67

Would it be a good idea to try matching the current setting as configured in drawSelection extension?

nightwing commented 9 months ago

This sounds like a good idea, but do you know any non-hacky way to get that value from codemirror? The only solution i know so far is to do drawSelection()[0].facet ignoring the typing errors, which is not very good.

krassowski commented 9 months ago

I think it should be available from cm.view.state.facet(selectionConfig) but selectionConfig is not currently exported. I asked on the forum: https://discuss.codemirror.net/t/how-to-get-cursor-blinking-rate-in-another-extension/7077

krassowski commented 9 months ago

It should be possible to use getDrawSelectionConfig function in future versions, see https://discuss.codemirror.net/t/how-to-get-cursor-blinking-rate-in-another-extension/7077/5