I may have missed something obvious but curious about the behavior here.
When I right-click to bring up the context menu on an empty line, the line break is automatically selected, which also moves the caret to the next line:
I understand this might be too minor, but it can sometimes be inconvenient because if I wanted to do something that inserts text into an empty line (for example, pasting text into the caret position), it deletes an extra line break.
Just curious, is there an easy to avoid this behavior?
Can confirm that macOS browsers seem to do this. They do it in textarea and raw contenteditable elements too, so I guess it’s some kind of platform convention? It’d be messy (though probably possible) for CodeMirror to interfere here, and I’m not sure that’s the right call—if this is the expected behavior in such controls, it may be reasonable to align with that, even if VS Code doesn’t.
Yeah I agree we’d rather not change if it’s something the system does. Pretty weird WebView does this while TextView (TextEdit.app) does the opposite, quite inconsistent, though.
I will take a look at the WebKit implementation at some point, thanks.