patch 9.2.0127: line('w0') and line('w$') return wrong values in a terminal
Problem: In a terminal window, line('w0') and line('w$') return wrong
values instead of the first and last visible line number,
because a terminal buffer does not go through the normal
redraw path that updates w_topline and w_botline (ubaldot).
Solution: Before computing w0 and w$, sync the terminal contents to the
buffer by calling may_move_terminal_to_buffer() so that
w_topline and w_botline are correctly updated.