71 / dance

Make your cursors dance with Kakoune-like modal editing in VS Code.
https://marketplace.visualstudio.com/items?itemName=gregoire.dance
ISC License
428 stars 54 forks source link

Dance selection not matching VSCode #331

Open noonien opened 5 months ago

noonien commented 5 months ago

Using

    "dance.modes": {
        "normal": {
            "cursorStyle": "block",
            "selectionBehavior": "character",
            "lineNumbers": "off",
            "decorations": {
                "isWholeLine": false,
            },
        },
    },

While the block is selecting the last character, it is not marked as a selection in VScode, this results in some weird behavior:

In the following screenshot, info is selected, but having "Editor: Selection Highlight" enabled, the next occurrence of inf is selected, instead of the complete info:

image

This also means that when double clicking on info, because VScode selects the entire word, Dance also has the closing bracket selected: image

71 commented 2 months ago

This is done on purpose, though I agree this isn't ideal. The problem is that the VS Code block character appears after the selection; for users that don't use extensions like Dance this is probably fine, but in Dance it is very confusing as you can often perform operations that appear to have the block character selected, when they in fact do not.

When the block cursor is selected, Dance will add +1 to the length of selections when performing actions to account for that block character, but regular VS Code behavior (like highlighting of matches) will behave slightly differently.

For instance, in your first screenshot, pressing d will remove info (which, IMO, makes more sense visually), but VS Code internally thinks that o is not part of the selection.

Some time ago Dance used the native VS Code selection, but this was changed due to how strange it looked to users.