fix max insertion point offset
implement up/down arrow cursor movement
add some tests