Limit cursor to move within view limits