Edit book: Fix pressing Ctrl+Tab inserting a tab at the start of a line instead of switching tabs

This commit is contained in:
Kovid Goyal 2021-09-26 08:37:24 +05:30
parent 95fc272b5b
commit 5f6dcd9e8b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 12 additions and 6 deletions

View File

@ -67,7 +67,9 @@ class Smarts(NullSmarts):
if key == Qt.Key.Key_Home and smart_home(editor, ev):
return True
if key == Qt.Key.Key_Tab and smart_tab(editor, ev):
if key == Qt.Key.Key_Tab:
mods = ev.modifiers()
if not mods & Qt.KeyboardModifier.ControlModifier and smart_tab(editor, ev):
return True
if key == Qt.Key.Key_Backspace and smart_backspace(editor, ev):

View File

@ -723,7 +723,9 @@ class Smarts(NullSmarts):
if key == Qt.Key.Key_Home and smart_home(editor, ev):
return True
if key == Qt.Key.Key_Tab and smart_tab(editor, ev):
if key == Qt.Key.Key_Tab:
mods = ev.modifiers()
if not mods & Qt.KeyboardModifier.ControlModifier and smart_tab(editor, ev):
return True
if key == Qt.Key.Key_Backspace and smart_backspace(editor, ev):

View File

@ -36,7 +36,9 @@ class Smarts(NullSmarts):
def handle_key_press(self, ev, editor):
key = ev.key()
if key == Qt.Key.Key_Tab and smart_tab(editor, ev):
if key == Qt.Key.Key_Tab:
mods = ev.modifiers()
if not mods & Qt.KeyboardModifier.ControlModifier and smart_tab(editor, ev):
return True
elif key == Qt.Key.Key_Backspace and smart_backspace(editor, ev):