From 316201354cbfa148b1bb743646b980143504a0ff Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 28 Feb 2016 15:28:46 +0530 Subject: [PATCH] Edit Book: Fix spelling correction suggestions not being shown when using the context menu key with the cursor at the end of the word --- src/calibre/gui2/tweak_book/editor/text.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tweak_book/editor/text.py b/src/calibre/gui2/tweak_book/editor/text.py index cffba04683..327bdf6513 100644 --- a/src/calibre/gui2/tweak_book/editor/text.py +++ b/src/calibre/gui2/tweak_book/editor/text.py @@ -563,7 +563,7 @@ class TextEdit(PlainTextEdit): formats = self.highlighter.parse_single_block(c.block())[0] pos = c.positionInBlock() for r in formats: - if r.start <= pos < r.start + r.length and r.format.property(SPELL_PROPERTY): + if r.start <= pos <= r.start + r.length and r.format.property(SPELL_PROPERTY): return r.format.property(SPELL_LOCALE_PROPERTY) def recheck_word(self, word, locale): @@ -583,7 +583,7 @@ class TextEdit(PlainTextEdit): return pos = cursor.positionInBlock() for r in cursor.block().layout().additionalFormats(): - if r.start <= pos < r.start + r.length and r.format.property(SYNTAX_PROPERTY): + if r.start <= pos <= r.start + r.length and r.format.property(SYNTAX_PROPERTY): return r def syntax_format_for_cursor(self, cursor):