Handle case when col number moves cursor more than one line past the originating line

This commit is contained in:
Kovid Goyal 2013-12-10 21:59:43 +05:30
parent f383456f52
commit d28c4b5358

View File

@ -198,7 +198,8 @@ class TextEdit(QPlainTextEdit):
else:
c.setPosition(c.block().position() + col)
if c.blockNumber() + 1 > lnum:
c.movePosition(c.PreviousBlock)
# We have moved past the end of the line
c.setPosition(c.block().position())
c.movePosition(c.EndOfBlock)
self.setTextCursor(c)
self.ensureCursorVisible()