diff --git a/src/calibre/gui2/tweak_book/__init__.py b/src/calibre/gui2/tweak_book/__init__.py index 4051bff500..e40b50168c 100644 --- a/src/calibre/gui2/tweak_book/__init__.py +++ b/src/calibre/gui2/tweak_book/__init__.py @@ -64,6 +64,7 @@ d['editor_format_toolbar'] = [('format-text-' + x) if x else x for x in ( d['spell_check_case_sensitive_search'] = False d['add_cover_preserve_aspect_ratio'] = False d['templates'] = {} +d['auto_close_tags'] = True del d ucase_map = {l:string.ascii_uppercase[i] for i, l in enumerate(string.ascii_lowercase)} diff --git a/src/calibre/gui2/tweak_book/editor/smarts/html.py b/src/calibre/gui2/tweak_book/editor/smarts/html.py index a6cd3e950c..63be2a8cb8 100644 --- a/src/calibre/gui2/tweak_book/editor/smarts/html.py +++ b/src/calibre/gui2/tweak_book/editor/smarts/html.py @@ -619,6 +619,8 @@ class Smarts(NullSmarts): editor.setTextCursor(c) def auto_close_tag(self, editor): + if not tprefs['auto_close_tags']: + return False def check_if_in_tag(block, offset=0): if block.isValid(): diff --git a/src/calibre/gui2/tweak_book/preferences.py b/src/calibre/gui2/tweak_book/preferences.py index f57bbb9448..b4e3b1a527 100644 --- a/src/calibre/gui2/tweak_book/preferences.py +++ b/src/calibre/gui2/tweak_book/preferences.py @@ -194,6 +194,12 @@ class EditorSettings(BasicSettings): ' happens only when the trailing semi-colon is typed.')) l.addRow(lw) + lw = self('auto_close_tags') + lw.setText(_('Auto &close tags when typing ')) + lw.setToolTip('
' + _( + 'With this option, every time you type the current HTML closing tag is auto-completed')) + l.addRow(lw) + lw = self('editor_show_char_under_cursor') lw.setText(_('Show the name of the current character before the cursor along with the line and column number')) l.addRow(lw)