Adding support for ctrl+backspace in searchbars
This commit is contained in:
@@ -6,3 +6,23 @@ def YesNoDialog(question='Are you sure you want to do this?', caption='Yes or no
|
||||
result = dlg.ShowModal() == wx.ID_YES
|
||||
dlg.Destroy()
|
||||
return result
|
||||
|
||||
|
||||
def HandleCtrlBackspace(textControl):
|
||||
"""
|
||||
Handles the behavior of Windows ctrl+space
|
||||
deletes everything from the cursor to the left,
|
||||
up to the next whitespace.
|
||||
"""
|
||||
curPos = textControl.GetInsertionPoint()
|
||||
searchText = textControl.GetValue()
|
||||
foundChar = False
|
||||
for startIndex in range(curPos, -1, -1):
|
||||
if startIndex - 1 < 0:
|
||||
break
|
||||
if searchText[startIndex - 1] != " ":
|
||||
foundChar = True
|
||||
elif foundChar:
|
||||
break
|
||||
textControl.Remove(startIndex, curPos)
|
||||
textControl.SetInsertionPoint(startIndex)
|
||||
Reference in New Issue
Block a user