terminal
terminal copied to clipboard
`SetConptyOption` API (was: Ctrl-Backspace doesn't respect word delimiters even though normal cmd window does)
Windows Terminal version (or Windows build number)
1.10.2714.0
Other Software
cmd in a Windows Terminal profile.
Steps to reproduce
I followed the steps here (that is, I set the HKCU\Console\WordDelimiters registry key for cmd). Now if I open a regular cmd window, Ctrl-Backspace respects those word delimiters. But if I do the same in a cmd profile in Windows Terminal, it doesn't respect those delimiters. I've tried making Windows Terminal's word delimiters the same as those in that registry key, restarting Windows Terminal and restarting my machine, but it still doesn't work.
Expected Behavior
If the cursor is at the end of the following line:
C:>cd users\foo\bar
and I press Ctrl-Backspace, I expect it to delete just the word "bar".
Actual Behavior
Instead, it deletes the entire string users\foo\bar. This only happens in a cmd profile in Windows Terminal. In a normal cmd window, it only deletes the word "bar" as I expect.
hmmmmmmmmmmmmm this is probably due to us totally ignoring the registry settings for all conpty sessions. FWIW, did you set HKEY_CURRENT_USER\Console\WordDelimiters
(the "defaults" reg key) or HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe\WordDelimiters
(the reg key specific to cmd.exe
windows)?
Ooh, that got me excited for a minute :). I'd set the first one earlier. Following your suggestion, I set the second one too (I have both set now) but it's still not working :(. In the cmd window it works whether I set both or either one.
Have you find a solution?
I am using Terminal version 1.14.1962.0 and this is still an issue.
This is also an issue using ctrl-left and ctrl-right. They do not respect the word delimiters either. This does work in the old conhost window.
I have tried settings word delimiters in the terminal settings and in the registry at HKEY_CURRENT_USER\Console\WordDelimiters
and HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe\WordDelimiters
Just ran into Windows Terminal Version: 1.15.2875.0 with cmd.exe and with powershell.exe not respecting the word delimiters with ctrl-left and ctrl-right. Double clicking does respect the word delimeters.
Okay, so we're promoting this one as the thread. We need a better way of setting properties on the pseudoconsole. We've kinda been discussing this in the (virtual) halls for a while.
We'll have more discussion here in the future.
Is there a public Win32 API call to set the word break characters for a console?
No, we don't have one, since the delimiters are traditionally considered a property of the terminal/console and not of any application running within it. Applications that need customized input handling (i.e. the way vim, etc., which allows this to be customized) should for instance use a readline implementation that offers this. Users that just want to modify their selection behavior, etc., need to use the WordDelimiters
registry value mentioned above.