terminal icon indicating copy to clipboard operation
terminal copied to clipboard

`SetConptyOption` API (was: Ctrl-Backspace doesn't respect word delimiters even though normal cmd window does)

Open akshaykk opened this issue 3 years ago • 8 comments

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.

akshaykk avatar Oct 12 '21 23:10 akshaykk

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)?

zadjii-msft avatar Oct 14 '21 01:10 zadjii-msft

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.

akshaykk avatar Oct 14 '21 05:10 akshaykk

Have you find a solution?

KonoVitoDa avatar Jul 08 '22 23:07 KonoVitoDa

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

RadAd avatar Aug 15 '22 10:08 RadAd

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.

HarjitSi avatar Nov 10 '22 19:11 HarjitSi

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.

zadjii-msft avatar Dec 14 '22 22:12 zadjii-msft

Is there a public Win32 API call to set the word break characters for a console?

RadAd avatar Feb 15 '24 03:02 RadAd

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.

lhecker avatar Feb 15 '24 18:02 lhecker