correctly set commandpos = -1 when an edit leaves cursor at end of input