]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.2.0127: line('w0') and line('w$') return wrong values in a terminal v9.2.0127
authorChristian Brabandt <cb@256bit.org>
Mon, 9 Mar 2026 18:26:41 +0000 (18:26 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 9 Mar 2026 18:26:41 +0000 (18:26 +0000)
commitffeb2339cb2f3eba2fa34a955747853b672cfa76
tree782aeff21e782a7a7cd1f534c21dc769e3a2c9c0
parent727f6e2686fb1d06b9591e6de689763a479cc664
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.

fixes:  #19585
closes: #19615

supported by AI claude.

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/eval.c
src/proto/terminal.pro
src/terminal.c
src/testdir/test_terminal3.vim
src/version.c