go to appropriate line when coming from another cell

Sets the cursor on the last line of the cell when moved up from the top
of the cell below, and sets the cursors to the first line when moving
down from the bottom of a last line.

Here, we retain the character that the cursor was on, so that users
wishing to have up-down functionality like one document can still use
this shortcut handler and simple adjust the at_top and at_bottom methods