Edit Book: Add an option to turn off auto-completion of closing tags

This commit is contained in:
Kovid Goyal 2015-02-04 09:17:09 +05:30
parent 8cc82b6c8f
commit bfae849753
3 changed files with 9 additions and 0 deletions

View File

@ -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['spell_check_case_sensitive_search'] = False
d['add_cover_preserve_aspect_ratio'] = False d['add_cover_preserve_aspect_ratio'] = False
d['templates'] = {} d['templates'] = {}
d['auto_close_tags'] = True
del d del d
ucase_map = {l:string.ascii_uppercase[i] for i, l in enumerate(string.ascii_lowercase)} ucase_map = {l:string.ascii_uppercase[i] for i, l in enumerate(string.ascii_lowercase)}

View File

@ -619,6 +619,8 @@ class Smarts(NullSmarts):
editor.setTextCursor(c) editor.setTextCursor(c)
def auto_close_tag(self, editor): def auto_close_tag(self, editor):
if not tprefs['auto_close_tags']:
return False
def check_if_in_tag(block, offset=0): def check_if_in_tag(block, offset=0):
if block.isValid(): if block.isValid():

View File

@ -194,6 +194,12 @@ class EditorSettings(BasicSettings):
' happens only when the trailing semi-colon is typed.')) ' happens only when the trailing semi-colon is typed.'))
l.addRow(lw) l.addRow(lw)
lw = self('auto_close_tags')
lw.setText(_('Auto &close tags when typing </'))
lw.setToolTip('<p>' + _(
'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 = 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')) lw.setText(_('Show the name of the current character before the cursor along with the line and column number'))
l.addRow(lw) l.addRow(lw)