From d31bf5a1acb4975d8c5cf5030ff88a5efe620097 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Dec 2014 08:56:17 +0530 Subject: [PATCH] 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). --- src/calibre/gui2/tweak_book/editor/smarts/html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/editor/smarts/html.py b/src/calibre/gui2/tweak_book/editor/smarts/html.py index 9510e8e6c3..10f699c37e 100644 --- a/src/calibre/gui2/tweak_book/editor/smarts/html.py +++ b/src/calibre/gui2/tweak_book/editor/smarts/html.py @@ -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)