Handles the behavior of Windows ctrl+space deletes everything from the cursor to the left, up to the next whitespace.
(textControl)
| 8 | |
| 9 | |
| 10 | def 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) |
no test coverage detected