Edit Book: When jumping to next occurrence of a word, take language into account

This commit is contained in:
Kovid Goyal 2016-05-24 10:27:38 +05:30
parent 03c2c5ea89
commit a39fed6350

View File

@ -391,10 +391,12 @@ class TextEdit(PlainTextEdit):
c.setPosition(c.anchor() + idx) c.setPosition(c.anchor() + idx)
c.setPosition(c.position() + string_length(word), c.KeepAnchor) c.setPosition(c.position() + string_length(word), c.KeepAnchor)
if self.smarts.verify_for_spellcheck(c, self.highlighter): if self.smarts.verify_for_spellcheck(c, self.highlighter):
self.setTextCursor(c) locale = self.spellcheck_locale_for_cursor(c)
if center_on_cursor: if not lang or (locale and lang == locale.langcode):
self.centerCursor() self.setTextCursor(c)
return True if center_on_cursor:
self.centerCursor()
return True
c.setPosition(c.position()) c.setPosition(c.position())
c.movePosition(c.End, c.KeepAnchor) c.movePosition(c.End, c.KeepAnchor)