From a39fed6350942b1b3b122bd776acfda92306003f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 24 May 2016 10:27:38 +0530 Subject: [PATCH] Edit Book: When jumping to next occurrence of a word, take language into account --- src/calibre/gui2/tweak_book/editor/text.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/tweak_book/editor/text.py b/src/calibre/gui2/tweak_book/editor/text.py index 327bdf6513..62221bbf72 100644 --- a/src/calibre/gui2/tweak_book/editor/text.py +++ b/src/calibre/gui2/tweak_book/editor/text.py @@ -391,10 +391,12 @@ class TextEdit(PlainTextEdit): c.setPosition(c.anchor() + idx) c.setPosition(c.position() + string_length(word), c.KeepAnchor) if self.smarts.verify_for_spellcheck(c, self.highlighter): - self.setTextCursor(c) - if center_on_cursor: - self.centerCursor() - return True + locale = self.spellcheck_locale_for_cursor(c) + if not lang or (locale and lang == locale.langcode): + self.setTextCursor(c) + if center_on_cursor: + self.centerCursor() + return True c.setPosition(c.position()) c.movePosition(c.End, c.KeepAnchor)