Bug: Ctrl+Backspace in any wxTextCtrl inserts char 127 instead of delete last word

40 views
Skip to first unread message

QuentinC

unread,
Apr 7, 2021, 12:39:49 PM4/7/21
to wx-u...@googlegroups.com
Hello,

I have a small bug to report with wxWidgets 3.1.4 under windows.

A user just notified me that Ctrl+Bacspace should delete the last word
before the caret.
You can try it out everywhere under windows: in notepad, wordpad, and
even almost any text control you can find in almost any application.
For example if in the situation "One two three|" you press
Ctrl+Backspace, the text becomes "One two |" (| represents the caret)

However, in a wxWidgets application, pressing Ctrl+Backspace inserts a
character with ASCII code 127 instead
I can confirm this strange behavior in all the applications I made with
wxWidgets. It also occurrs in the samples, the "text" sample for example.
It doesn't occurs with an older version of wxWidgets (3.1.2).

Is it really a bug, or am I doing wrong in all my wx apps ?

Thank you for your answers.

Lauri Nurmi

unread,
Apr 7, 2021, 5:19:22 PM4/7/21
to wx-u...@googlegroups.com
QuentinC kirjoitti 7.4.2021 klo 19:39:
> Hello,
>
> I have a small bug to report with wxWidgets 3.1.4 under windows.
>
> A user just notified me that Ctrl+Bacspace should delete the last word
> before the caret.
> You can try it out everywhere under windows: in notepad, wordpad, and
> even almost any text control you can find in almost any application.
> However, in a wxWidgets application, pressing Ctrl+Backspace inserts a
> character with ASCII code 127 instead

I don't know if it's a bug or not, but I just want to point out that it
is native behaviour on Windows: try pressing Ctrl+Backspace in Notepad's
Find dialog, and the same thing happens. At least on Windows 7.


David Connet

unread,
Apr 7, 2021, 5:32:50 PM4/7/21
to wx-u...@googlegroups.com
Ah consistency. And ctrl+bksp in the main notepad body deletes the word.

I just tried in my app (on windows) and ctrl+bksp deleted a word in the
combobox and multiline edit controls. Single line edit controls seem to
insert 127 (I assume that's what the box is).

Dave

Vadim Zeitlin

unread,
Apr 7, 2021, 5:36:03 PM4/7/21
to wx-u...@googlegroups.com
On Wed, 7 Apr 2021 14:32:47 -0700 David Connet wrote:

DC> Ah consistency. And ctrl+bksp in the main notepad body deletes the word.

This has apparently finally changed in a recent version of Windows 10, see
https://superuser.com/a/1394235/60311

The full story is, as usual, in Raymond Chen's blog:

http://web.archive.org/web/20081207233529if_/http://blogs.msdn.com/oldnewthing/archive/2007/10/11/5395501.aspx

Anyhow, I wanted to implement this quickly, but it turns out that this is
not as simple as I thought because of this weird interaction with
SHAutoComplete(). I'll still try to do it, but I just wanted to post before
others waste time investigating this, as I can confirm that Raymond,
unsurprisingly, is right: this shortcut only worked when auto-completion
was enabled (until relatively recently) and we need to do it ourselves if
we want it to always work everywhere under older systems.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

David Connet

unread,
Apr 7, 2021, 5:48:28 PM4/7/21
to wx-u...@googlegroups.com
On 4/7/2021 2:36 PM, Vadim Zeitlin wrote:
> On Wed, 7 Apr 2021 14:32:47 -0700 David Connet wrote:
>
> DC> Ah consistency. And ctrl+bksp in the main notepad body deletes the word.
>
> This has apparently finally changed in a recent version of Windows 10, see
> https://superuser.com/a/1394235/60311

Ah, I'm on 20H2. (for those who did't follow the link, it was added in
Win10-1809)

Dave

Vadim Zeitlin

unread,
Apr 7, 2021, 7:29:57 PM4/7/21
to wx-u...@googlegroups.com
On Wed, 7 Apr 2021 23:36:00 +0200 I wrote:

Me> On Wed, 7 Apr 2021 14:32:47 -0700 David Connet wrote:
Me>
Me> DC> Ah consistency. And ctrl+bksp in the main notepad body deletes the word.
Me>
Me> This has apparently finally changed in a recent version of Windows 10, see
Me> https://superuser.com/a/1394235/60311
Me>
Me> The full story is, as usual, in Raymond Chen's blog:
Me>
Me> http://web.archive.org/web/20081207233529if_/http://blogs.msdn.com/oldnewthing/archive/2007/10/11/5395501.aspx
Me>
Me> Anyhow, I wanted to implement this quickly, but it turns out that this is
Me> not as simple as I thought
[...]

Who could have had foreseen that all 3 cases where the system supports
this on its own, namely:

1. Rich edit controls.
2. Plain edit controls that use SHAutoComplete().
3. Notepad in Windows 10 1809 and later.

handle this shortcut in subtly different ways? I guess anybody with enough
of MSW UI experience...

I've finally made

https://github.com/wxWidgets/wxWidgets/pull/2317

keeping it as simple as possible because consistency doesn't seem to be
achievable anyhow here.

Please test it if you can, even the simplest implementation is still not
quite trivial and could be buggy.

TIA!

QuentinC

unread,
Apr 8, 2021, 1:38:06 AM4/8/21
to wx-u...@googlegroups.com
Hello,

DC> This has apparently finally changed in a recent version of Windows
10, see
https://superuser.com/a/1394235/60311

Thank you David for the whole story.
So it isn't as universal as I supposed it to be and as the user reported
it to me.

VZ> I've finally made
https://github.com/wxWidgets/wxWidgets/pull/2317
Please test it if you can, even the simplest implementation is still
not quite trivial and could be buggy.

Thank you Vadim, I'll have a look at that soon.
I'll have to build the whole 3.1.5 ongoing version, so this will take
some time. Probably not after next week-end.

Thank you for your answers.
All the best.

david.l...@lanxess.com

unread,
Apr 8, 2021, 3:05:41 AM4/8/21
to wx-u...@googlegroups.com
>An: wx-u...@googlegroups.com
>Von: "QuentinC" 
>Gesendet von: wx-u...@googlegroups.com
>Datum: 07.04.2021 18:39
>Betreff: Bug: Ctrl+Backspace in any wxTextCtrl inserts char 127
>instead of delete last word

Hi Quentin,

I've just tried this out since I did not know about the feature until now. I can't confirm that this is working everywhere in my Windows 7 installation.
Word 2016 deletes the last word but notepad.exe adds char 127. 
Also our own wxWidgets based application deletes the last word in our wxTextCtrls with flags wxTE_RICH2 | wxTE_MULTILINE | wxTE_PROCESS_ENTER


Regards

David



Vadim Zeitlin

unread,
Apr 8, 2021, 3:56:31 AM4/8/21
to wx-u...@googlegroups.com
On Thu, 8 Apr 2021 09:05:34 +0200 wrote:

> Also our own wxWidgets based application deletes the last word in our
> wxTextCtrls with flags wxTE_RICH2 | wxTE_MULTILINE | wxTE_PROCESS_ENTER

Yes, rich edit controls support this natively (albeit in a different way
than Notepad in Windows 10, of course), so if you use use wxTE_RICH or
wxTE_RICH2 it already works. And, to repeat, the really funny thing is that
plain text edit controls also get support for it if you call the apparently
completely unrelated AutoCompleteFileNames() on them.

Regards,
Reply all
Reply to author
Forward
0 new messages