Skip to content

Fix backspacing wx textbox when there is selected text#1193

Merged
kitchoi merged 2 commits intomasterfrom
wx-backspace-textbox-selection
Sep 4, 2020
Merged

Fix backspacing wx textbox when there is selected text#1193
kitchoi merged 2 commits intomasterfrom
wx-backspace-textbox-selection

Conversation

@kitchoi
Copy link
Contributor

@kitchoi kitchoi commented Sep 4, 2020

This PR fixes the implementation of KeyClick("Backspace") on wx.TextCtrl when there is already some selected text.

For reference, we could not get wx.TextCtrl.EmulateKeyPress to emulate backspace on Windows, hence we had to emulate it ourselves. See #1184 and this discussion on wxPython forum.

…erent platforms - not necessary for the purpose of this test.
textbox.SetValue("ABCDE")
textbox.SetSelection(0, 4)
# sanity check
self.assertEqual(textbox.GetStringSelection(), "ABCD")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pedantic: This is not really a test objective so if the setup is not what we expect, we should raise a different exception to cause the test to "error", not to "fail". I am not a purist and the comment explains the intent of this assertion already so I am going to leave it here. Happy to remove it too if others find this confusing.

@kitchoi kitchoi requested review from aaronayres35 and rahulporuri and removed request for aaronayres35 September 4, 2020 11:18
Copy link
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kitchoi kitchoi merged commit fb94337 into master Sep 4, 2020
@kitchoi kitchoi deleted the wx-backspace-textbox-selection branch September 4, 2020 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants