VSCode Version:
Version 1.3.0-insider (1.3.0-insider)
a21c123
2016-06-30T05:01:53.185Z
OS Version:
OSX 10.11.5 (15F34)
Steps to Reproduce:
In any standard OSX text area, this results in the text 'a' being killed, then the second kill deletes the empty line.
In VS Code, the 'a' gets killed, but the second kill has no effect.
As a user habituated to the standard text commands, this is very annoying, because it prevents me from quickly deleting multiple lines of text; instead, I have to alternate between ctrl-k and ctrl-d.
fyi @joaomoreno
@gwk We bind ctrl+k on the mac to deleteAllRight.
https://github.com/Microsoft/vscode/blob/master/src/vs/editor/common/config/config.ts#L295
registerCoreCommand(H.DeleteAllRight, {
primary: null,
mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_K, secondary: [KeyMod.CtrlCmd | KeyCode.Delete] }
});
That was my understanding of ctrl+k from https://support.apple.com/en-gb/HT201236

Should ctrl+k bind by default to editor.action.deleteLines or should it handle differently the empty line case in its implementation?
@alexandrudima the support article you mention does not describe the 'empty line' case, but it is real, and I hope vscode will support it. Should editor.action.deleteLines handle this case, or do we need a new action?
I tried to find more reference material but it is not very interesting. The system default cocoa keybinding is found in /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict:
"^k": "deleteToEndOfParagraph:"
This name refers to the NSResponder method documented here:
The actual implementation is by NSTextView, NSTextField and whoever else, and I don't see a specification of implemented behavior.
After testing it in three other apps (Sublime, TextEdit, Notes), this is the behaviour I distilled:
@alexandrudima Should we implement a context for it (cursorAtEndOfLine) or should we just create a new command SpecialDeleteAllRight?
Agree with @joaomoreno, the behavior is dependent on cursor position, not line contents as I implied earlier! For what it's worth, I think the determination should be made based on the behavior of (default) cocoa text fields, and not Sublime Text, which is a completely custom implementation.
I would go for changing the implementation of DeleteAllRight. I am pretty sure the only reason we added it was for mac's ctrl+k.
I stumbled across this today. I miss this behavior of ctrl-k since it works almost everywhere in Mac.
This is the normal emacs (not only Mac) keybinding that also work in the terminal and any linux DE with emacs keybinding.
Would love to see this fixed/changed - I have so much muscle memory around Ctrl-K working as described by @joaomoreno above.
I can take this, @alexandrudima. 馃憤
@joaomoreno I've just moved the code to a better place, outside the editor core (lineOperations.ts)
馃挴
Did that land in 1.8.1 yet?
Nope.
Can this be done for DeleteAllLeft as well?
What's the keybinding for that?
@joaomoreno it's cmd+backspace on mac (I imagine cmd+del on Windows)
Yeah, wanna file an issue for it? You can ping me there.
Most helpful comment
I would go for changing the implementation of
DeleteAllRight. I am pretty sure the only reason we added it was for mac'sctrl+k.