Allow using Control-t shortcut
@@ -239,6 +239,7 @@ class EnhancedText(TweakableText):
self.bind("<Control-BackSpace>", if_not_readonly(self.delete_word_left), True)
self.bind("<Control-Delete>", if_not_readonly(self.delete_word_right), True)
self.bind("<Control-d>", self._redirect_ctrld, True)
+ self.bind("<Control-t>", self._redirect_ctrlt, True)
self.bind("<BackSpace>", if_not_readonly(self.perform_smart_backspace), True)
self.bind("<Return>", if_not_readonly(self.perform_return), True)
self.bind("<KP_Enter>", if_not_readonly(self.perform_return), True)
@@ -278,11 +279,17 @@ class EnhancedText(TweakableText):
self.bind("<3>", self._on_mouse_click, True)
def _redirect_ctrld(self, event):
- # I want to disable the deletion effect of CtrlD in the text but still
+ # I want to disable the deletion effect of Ctrl-D in the text but still
# keep the event for other purposes
self.event_generate("<<CtrlDInText>>")
return "break"
+ def _redirect_ctrlt(self, event):
+ # I want to disable the swap effect of Ctrl-T in the text but still
+ # keep the event for other purposes
+ self.event_generate("<<CtrlTInText>>")
+ return "break"
+
def tag_reset(self, tag_name):
empty_conf = {key: "" for key in self.tag_configure(tag_name)}
self.tag_configure(empty_conf)
