Implement cursor movement among query and lines