Bugfix: Fixed cursor positioning

Fixed bug causing incorrect cursor positioning when scrolling the
message window using page up/down keys