In Windows, Ctrl+Backspace commonly serves as a shortcut to delete the word immediately preceding the cursor. It is equivalent to Ctrl+Shift+Left followed by Backspace.
In WinForms, this shortcut works only in single-line TextBox controls which have autocomplete enabled. This is actually built into SHAutoComplete somewhere in the win32 API, and is a "rogue feature" with no documentation (some history here). If the TextBox is multi-line or doesn't have autocomplete on, Ctrl+Backspace inserts a DELETE character (ASCII 127) instead.
Note: The Ctrl+Delete shortcut (which deletes the word following the cursor) works in all relevant WinForms controls.
Outside of WinForms, the Ctrl+Backspace shortcut is nearly ubiquitous on Windows (as of October 2018, even Notepad finally has it!). As such, I propose properly implementing it in WinForms controls such as TextBoxBase and ComboBox with a custom handler for Ctrl+Backspace.
I've submitted a PR with one approach to add this shortcut, namely using SendInput sending native messages to simulate the aforementioned Ctrl+Shift+Left, Backspace keystrokes. I believe this is the right approach — as even the current autocomplete TextBox "feature" seems to be selecting the text and then deleting it if you watch closely.
Another possibility would be to use internal text selection functions rather than sending keystrokes. However, that requires replicating the logic dealing with word boundaries/punctuation currently used by Ctrl+Shift+Left, which is a bit quirky, not to mention wildly inconsistent between different Windows programs. We can consider this approach if the current PR is lacking.
In Windows,
Ctrl+Backspacecommonly serves as a shortcut to delete the word immediately preceding the cursor. It is equivalent toCtrl+Shift+Leftfollowed byBackspace.In WinForms, this shortcut works only in single-line
TextBoxcontrols which have autocomplete enabled. This is actually built intoSHAutoCompletesomewhere in the win32 API, and is a "rogue feature" with no documentation (some history here). If theTextBoxis multi-line or doesn't have autocomplete on,Ctrl+Backspaceinserts a DELETE character (ASCII 127) instead.Note: The
Ctrl+Deleteshortcut (which deletes the word following the cursor) works in all relevant WinForms controls.Outside of WinForms, the
Ctrl+Backspaceshortcut is nearly ubiquitous on Windows (as of October 2018, even Notepad finally has it!). As such, I propose properly implementing it in WinForms controls such asTextBoxBaseandComboBoxwith a custom handler forCtrl+Backspace.I've submitted a PR with one approach to add this shortcut, namely
usingsending native messages to simulate the aforementionedSendInputCtrl+Shift+Left, Backspacekeystrokes. I believe this is the right approach — as even the current autocompleteTextBox"feature" seems to be selecting the text and then deleting it if you watch closely.Another possibility would be to use internal text selection functions rather than sending keystrokes. However, that requires replicating the logic dealing with word boundaries/punctuation currently used by
Ctrl+Shift+Left, which is a bit quirky, not to mention wildly inconsistent between different Windows programs. We can consider this approach if the current PR is lacking.