MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / HandleCtrlBackspace

Function HandleCtrlBackspace

gui/utils/helpers_wxPython.py:10–27  ·  view source on GitHub ↗

Handles the behavior of Windows ctrl+space deletes everything from the cursor to the left, up to the next whitespace.

(textControl)

Source from the content-addressed store, hash-verified

8
9
10def HandleCtrlBackspace(textControl):
11 """
12 Handles the behavior of Windows ctrl+space
13 deletes everything from the cursor to the left,
14 up to the next whitespace.
15 """
16 curPos = textControl.GetInsertionPoint()
17 searchText = textControl.GetValue()
18 foundChar = False
19 for startIndex in range(curPos, -1, -1):
20 if startIndex - 1 < 0:
21 break
22 if searchText[startIndex - 1] != " ":
23 foundChar = True
24 elif foundChar:
25 break
26 textControl.Remove(startIndex, curPos)
27 textControl.SetInsertionPoint(startIndex)

Callers 3

OnKeyPressMethod · 0.90
OnKeyDownMethod · 0.90

Calls 1

GetValueMethod · 0.45

Tested by

no test coverage detected