From b616b15dd3f47334d8fbc973ff1638abce0c6751 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 9 Jul 2014 09:53:49 +0530 Subject: [PATCH] Edit Book: Fix inline spell check context menu not working when triggered by context menu key or a right clicking at the right edge of the word. --- src/calibre/gui2/tweak_book/editor/widget.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/gui2/tweak_book/editor/widget.py b/src/calibre/gui2/tweak_book/editor/widget.py index 4f736ee260..84d5fd8d14 100644 --- a/src/calibre/gui2/tweak_book/editor/widget.py +++ b/src/calibre/gui2/tweak_book/editor/widget.py @@ -396,6 +396,10 @@ class Editor(QMainWindow): a = m.addAction c = self.editor.cursorForPosition(pos) r = self.editor.syntax_range_for_cursor(c) + if (r is None or not r.format.property(SPELL_PROPERTY).toBool()) and c.positionInBlock() > 0: + c.setPosition(c.position() - 1) + r = self.editor.syntax_range_for_cursor(c) + if r is not None and r.format.property(SPELL_PROPERTY).toBool(): word = self.editor.text_for_range(c.block(), r) locale = self.editor.spellcheck_locale_for_cursor(c)