term: Fix cursor position not in sync with scroll offset