dance icon indicating copy to clipboard operation
dance copied to clipboard

incorrect line highlighting in insert mode

Open jbytes1027 opened this issue 3 years ago • 4 comments

when a line character is selected in insert mode it is only half a character long and selects until the next line if the next line is a newline. See vid for details.

https://user-images.githubusercontent.com/50090107/122506254-f32c2780-cfcb-11eb-9e6f-a134e0a64a9f.mp4

jbytes1027 avatar Jun 18 '21 04:06 jbytes1027

This is a massive issue for me. I don't even like the left-over selection when going back to insert mode. I tried to remove it with selections.reduce but it still leaves a trail.

However, this one is even more annoying and is triggered all the time. Helix leaves no trail on a single character when going to insert mode. Here I can't find a way to go to insert mode without a trail. This trail on a newline also happens when using o as well.

wmstack avatar Feb 15 '24 08:02 wmstack

Hello, and sorry for the late response.

@jbytes1027 How would you expect things to look? IIRC "fake selections" (such as those left when entering insert mode) are a decoration with the same range as the previous (normal) selections, so the difference in display comes from VS Code. VS Code APIs don't give Dance the ability to precisely highlight "fake selections", but it might be possible to make things a bit better (by abusing styling allowed by decorations, and even that is not sure).

@wmstack You can prevent selections from being saved by configuring the normal mode as follows:

    "dance.modes": {
        "normal": {
            "onLeaveMode": [
                ".selections.reduce",
            ],
        },
    },

Does that work for you?

71 avatar Feb 17 '24 00:02 71

Hello, and sorry for the late response.

No worries, but I switched to vim awhile ago so this doesn't bother me anymore. Don't work on this because I asked.

How would you expect things to look

Don't remember, but I was using kakoune as a reference.

jbytes1027 avatar Feb 17 '24 01:02 jbytes1027

Well it works but it has a few issues, for one, the yank-delete-insert command associated with the c keybinding in normal mode only deletes a single character, the one that the cursor is on...

Yank-Delete-Insert can be fixed using some keybinding. I don't really prefer if the c command copies the selection so I have it mapped as

keybindings.json

{
        "key": "c",
        "command": "runCommands",
        "args": {
            "commands": ["dance.edit.delete", "dance.modes.insert.before"]
        },
        "when": "dance.mode == 'normal'"
}

Another issue is that the selection is gone when going into select mode, which is undesirable.

wmstack avatar Mar 03 '24 05:03 wmstack