Skip to content

Commit

Permalink
Edit Book: Fix inline spell check context menu not working when trigg…
Browse files Browse the repository at this point in the history
…ered by context menu key or a right clicking at the right edge of the word.
  • Loading branch information
kovidgoyal committed Jul 9, 2014
1 parent da29398 commit b616b15
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/calibre/gui2/tweak_book/editor/widget.py
Expand Up @@ -396,6 +396,10 @@ def show_context_menu(self, pos):
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)
Expand Down

0 comments on commit b616b15

Please sign in to comment.