Edit book: Fix auto-complete of closing tag not working when typing the closing tag at just before a word (the word would become the closing tag name).

This commit is contained in:
Kovid Goyal 2014-12-11 08:56:17 +05:30
parent 4d7b2a379a
commit d31bf5a1ac

View File

@ -613,7 +613,7 @@ class Smarts(NullSmarts):
def auto_close_tag(self, editor):
c = editor.textCursor()
block, offset = c.block(), c.positionInBlock()
tag = find_closest_containing_tag(block, offset, max_tags=4000)
tag = find_closest_containing_tag(block, offset - 1, max_tags=4000)
if tag is None:
return False
c.insertText('/%s>' % tag.name)