Repository: neovim
Issue: scrolling in true xterm ($XTERM_VERSION is defined) has visual glitches in all vertically adjacent buffers
Labels: bug,environment,tui,platform:bsd,has:workaround,display

### Neovim version (nvim -v)

0.6.0 Release

### Vim (not Nvim) behaves the same?

no, vim 8.2.4096 works regardless of terminal emulator (version) and/or TERM value

### Operating system/version

OpenBSD 7.0-current

### Terminal name/version

XTerm/OpenBSD(369)

### $TERM environment variable

xterm

### Installation

system package manager

### How to reproduce the issue

1. set `XTERM` to begin with `xterm`
2. set `XTERM_VERSION` to be non-empty
3. use defaults, no configuration
4. split windows vertically
5. scroll down one window such that at least one new line appears
6. observe the other window visually being scrolled and padded with blank lines accordingly
7. refresh screen (`^L`) to restore visual appearance

Setup/startup:
```
$ env -i TERM=xterm TERM_VERSION='XTerm/OpenBSD(369)' \
    "$(which nvim)" --clean -u NONE -V10./xterm-version-set-nonempty.log -O /usr/share/dict/words /usr/share/dict/words
```

Scrolling:
```
L
j
```

Observe visual artifacts, refresh screen, exit:
```
^L
:qa!
```

Repeating with xterm's version unset does not exibit the bahaviour:
```
$ env -i TERM=xterm \
    "$(which nvim)" --clean -u NONE -V10./xterm-version-unset.log -O /usr/share/dict/words /usr/share/dict/words
```

Difference between logs:
```
$ diff -u ./xterm-version-set-nonempty.log ./xterm-version-unset.log
--- ./xterm-version-set-nonempty.log
+++ ./xterm-version-unset.log
@@ -398,12 +398,9 @@
   set_background            setb       = <Esc>[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m
   enter_italics_mode        sitm       = <Esc>[3m
   exit_italics_mode         ritm       = <Esc>[23m
-  set_left_margin_parm      smglp      = <Esc>[%i%p1%ds
-  set_right_margin_parm     smgrp      = <Esc>[%i;%p2%ds
   key_mouse                 kmous      = <Esc>[M
-  set_a_foreground          setaf      = <Esc>[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38:5:%p1%d%;m
-  set_a_background          setab      = <Esc>[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48:5:%p1%d%;m
-  set_lr_margin             smglr      = <Esc>[%i%p1%d;%p2%ds
+  set_a_foreground          setaf      = <Esc>[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m
+  set_a_background          setab      = <Esc>[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m
   set_tb_margin             smgtb      = <Esc>[%i%p1%d;%p2%dr
   memory_lock               meml       = <Esc>l
   memory_unlock             memu       = <Esc>m
@@ -484,8 +481,527 @@
   ext.get_bg                = <Esc>]11;?<C-G>
   ext.resize_screen         = <Esc>[8;%p1%d;%p2%dt
   ext.reset_scroll_region   = <Esc>[r
-  setrgbf                   = <Esc>[38:2:%p1%d:%p2%d:%p3%dm
-  setrgbb                   = <Esc>[48:2:%p1%d:%p2%d:%p3%dm
+  setrgbf                   = <Esc>[38;2;%p1%d;%p2%d;%p3%dm
+  setrgbb                   = <Esc>[48;2;%p1%d;%p2%d;%p3%dm
+  ext.set_cursor_color      = <Esc>]12;#%p1%06x<C-G>
+  ext.reset_cursor_color    = <Esc>]112<C-G>
+  ext.save_title            = <Esc>[22;0t
+  ext.restore_title         = <Esc>[23;0t
+  ext.enable_lr_margin      = <Esc>[?69h
+  ext.disable_lr_margin     = <Esc>[?69l
+  ext.enable_bpaste         = <Esc>[?2004h
+  ext.disable_bpaste        = <Esc>[?2004l
+  ext.enable_focus          = <Esc>[?1004h
+  ext.disable_focus         = <Esc>[?1004l
+  ext.enable_mouse          = <Esc>[?1002h<Esc>[?1006h
+  ext.disable_mouse         = <Esc>[?1002l<Esc>[?1006l
+}}}
+
+W10: Warning: Changing a readonly file
+chdir(/home/kn/src/neovim)
+chdir(/usr/share/dict)
+chdir(/home/kn/src/neovim)
+Executing CursorMoved Autocommands for "*"
+autocommand call s:Highlight_Matching_Pair()
+
+Executing TextChanged Autocommands for "*"
+autocommand call s:Highlight_Matching_Pair()
+
+
+Executing WinLeave Autocommands for "*"
+autocommand call s:Remove_Matches()
+
+Executing WinEnter Autocommands for "*"
+autocommand call s:Highlight_Matching_Pair()
+
+Executing CursorMoved Autocommands for "*"
+autocommand call s:Highlight_Matching_Pair()
+
+
+chdir(/home/kn/src/neovim)
+chdir(/usr/share/dict)
+chdir(/home/kn/src/neovim)
+chdir(/home/kn/src/neovim)
+chdir(/usr/share/dict)
+chdir(/home/kn/src/neovim)
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/plugin)
+chdir(/home/kn/src/neovim)
+sourcing "/usr/local/share/nvim/runtime/plugin/gzip.vim"
+finished sourcing /usr/local/share/nvim/runtime/plugin/gzip.vim
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/plugin)
+chdir(/home/kn/src/neovim)
+sourcing "/usr/local/share/nvim/runtime/plugin/health.vim"
+finished sourcing /usr/local/share/nvim/runtime/plugin/health.vim
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/plugin)
+chdir(/home/kn/src/neovim)
+sourcing "/usr/local/share/nvim/runtime/plugin/man.vim"
+finished sourcing /usr/local/share/nvim/runtime/plugin/man.vim
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/plugin)
+chdir(/home/kn/src/neovim)
+sourcing "/usr/local/share/nvim/runtime/plugin/matchit.vim"
+not found in 'packpath': "pack/*/start/matchit"
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime)
+chdir(/home/kn/src/neovim)
+chdir(/home/kn/src/neovim)
+chdir(/etc/xdg/nvim)
+chdir(/home/kn/src/neovim)
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/site)
+chdir(/home/kn/src/neovim)
+chdir(/home/kn/src/neovim)
+chdir(/usr/share/nvim/site)
+chdir(/home/kn/src/neovim)
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime)
+chdir(/home/kn/src/neovim)
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/pack/dist/opt)
+chdir(/home/kn/src/neovim)
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/pack/dist/opt/matchit/plugin)
+chdir(/home/kn/src/neovim)
+line 3: sourcing "/usr/local/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim"
+finished sourcing /usr/local/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim
+continuing in /usr/local/share/nvim/runtime/plugin/matchit.vim
+finished sourcing /usr/local/share/nvim/runtime/plugin/matchit.vim
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/plugin)
+chdir(/home/kn/src/neovim)
+sourcing "/usr/local/share/nvim/runtime/plugin/matchparen.vim"
+finished sourcing /usr/local/share/nvim/runtime/plugin/matchparen.vim
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/plugin)
+chdir(/home/kn/src/neovim)
+sourcing "/usr/local/share/nvim/runtime/plugin/netrwPlugin.vim"
+finished sourcing /usr/local/share/nvim/runtime/plugin/netrwPlugin.vim
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/plugin)
+chdir(/home/kn/src/neovim)
+sourcing "/usr/local/share/nvim/runtime/plugin/rplugin.vim"
+chdir(/home/kn/src/neovim)
+chdir(/home/kn/.local/share/nvim)
+chdir(/home/kn/src/neovim)
+line 3: sourcing "/home/kn/.local/share/nvim/rplugin.vim"
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/autoload/remote)
+chdir(/home/kn/src/neovim)
+line 5: sourcing "/usr/local/share/nvim/runtime/autoload/remote/host.vim"
+finished sourcing /usr/local/share/nvim/runtime/autoload/remote/host.vim
+continuing in /home/kn/.local/share/nvim/rplugin.vim
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/autoload/remote)
+chdir(/home/kn/src/neovim)
+line 34: sourcing "/usr/local/share/nvim/runtime/autoload/remote/define.vim"
+finished sourcing /usr/local/share/nvim/runtime/autoload/remote/define.vim
+continuing in function remote#host#RegisterPlugin
+finished sourcing /home/kn/.local/share/nvim/rplugin.vim
+continuing in function <SNR>8_LoadRemotePlugins
+finished sourcing /usr/local/share/nvim/runtime/plugin/rplugin.vim
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/plugin)
+chdir(/home/kn/src/neovim)
+sourcing "/usr/local/share/nvim/runtime/plugin/shada.vim"
+finished sourcing /usr/local/share/nvim/runtime/plugin/shada.vim
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/plugin)
+chdir(/home/kn/src/neovim)
+sourcing "/usr/local/share/nvim/runtime/plugin/spellfile.vim"
+finished sourcing /usr/local/share/nvim/runtime/plugin/spellfile.vim
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/plugin)
+chdir(/home/kn/src/neovim)
+sourcing "/usr/local/share/nvim/runtime/plugin/tarPlugin.vim"
+finished sourcing /usr/local/share/nvim/runtime/plugin/tarPlugin.vim
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/plugin)
+chdir(/home/kn/src/neovim)
+sourcing "/usr/local/share/nvim/runtime/plugin/tohtml.vim"
+finished sourcing /usr/local/share/nvim/runtime/plugin/tohtml.vim
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/plugin)
+chdir(/home/kn/src/neovim)
+sourcing "/usr/local/share/nvim/runtime/plugin/tutor.vim"
+finished sourcing /usr/local/share/nvim/runtime/plugin/tutor.vim
+chdir(/home/kn/src/neovim)
+chdir(/usr/local/share/nvim/runtime/plugin)
+chdir(/home/kn/src/neovim)
+sourcing "/usr/local/share/nvim/runtime/plugin/zipPlugin.vim"
+finished sourcing /usr/local/share/nvim/runtime/plugin/zipPlugin.vim
+not found in 'packpath': "plugin/**/*.lua"
+not found in 'packpath': "pack/*/start/*"
+not found in 'packpath': "start/*"
+not found in runtime path: "plugin/**/*.vim"
+not found in runtime path: "plugin/**/*.lua"
+"/usr/share/dict/words" [readonly] 235971L, 2493843C
+Executing BufEnter Autocommands for "*"
+autocommand sil call s:LocalBrowse(expand("<amatch>"))
+
+Executing CursorMoved Autocommands for "*"
+autocommand call s:Highlight_Matching_Pair()
+
+chdir(/home/kn/src/neovim)
+chdir(/usr/share/dict)
+chdir(/home/kn/src/neovim)
+"/usr/share/dict/words" [readonly] 235971L, 2493843C
+Executing WinEnter Autocommands for "*"
+autocommand call s:Highlight_Matching_Pair()
+
+Executing CursorMoved Autocommands for "*"
+autocommand call s:Highlight_Matching_Pair()
+
+Executing VimEnter Autocommands for "*"
+autocommand sil call s:VimEnter(expand("<amatch>"))
+
+
+--- Terminal info --- {{{
+&term: xterm
+Description: xterm terminal emulator (X Window System)
+Aliases: xterm
+Boolean capabilities:
+  auto_left_margin          bw         = false
+  auto_right_margin         am         = true
+  no_esc_ctlc               xsb        = false
+  ceol_standout_glitch      xhp        = false
+  eat_newline_glitch        xenl       = true
+  erase_overstrike          eo         = false
+  generic_type              gn         = false
+  hard_copy                 hc         = false
+  has_meta_key              km         = true
+  has_status_line           hs         = false
+  insert_null_glitch        in         = false
+  memory_above              da         = false
+  memory_below              db         = false
+  move_insert_mode          mir        = true
+  move_standout_mode        msgr       = true
+  over_strike               os         = false
+  status_line_esc_ok        eslok      = false
+  dest_tabs_magic_smso      xt         = false
+  tilde_glitch              hz         = false
+  transparent_underline     ul         = false
+  xon_xoff                  xon        = false
+  needs_xon_xoff            nxon       = false
+  prtr_silent               mc5i       = true
+  hard_cursor               chts       = false
+  non_rev_rmcup             nrrmc      = false
+  no_pad_char               npc        = true
+  non_dest_scroll_region    ndscr      = false
+  can_change                ccc        = false
+  back_color_erase          bce        = true
+  hue_lightness_saturation  hls        = false
+  col_addr_glitch           xhpa       = false
+  cr_cancels_micro_mode     crxm       = false
+  has_print_wheel           daisy      = false
+  row_addr_glitch           xvpa       = false
+  semi_auto_right_margin    sam        = false
+  cpi_changes_res           cpix       = false
+  lpi_changes_res           lpix       = false
+  backspaces_with_bs        OTbs       = true
+  crt_no_scrolling          OTns       = false
+  no_correctly_working_cr   OTnc       = false
+  gnu_has_meta_key          OTMT       = false
+  linefeed_is_newline       OTNL       = false
+  has_hardware_tabs         OTpt       = false
+  return_does_clr_eol       OTxr       = false
+Numeric capabilities:
+  columns                   cols       = 80
+  init_tabs                 it         = 8
+  lines                     lines      = 24
+  lines_of_memory           lm         = -1
+  magic_cookie_glitch       xmc        = -1
+  padding_baud_rate         pb         = -1
+  virtual_terminal          vt         = -1
+  width_status_line         wsl        = -1
+  num_labels                nlab       = -1
+  label_height              lh         = -1
+  label_width               lw         = -1
+  max_attributes            ma         = -1
+  maximum_windows           wnum       = -1
+  max_colors                colors     = 256
+  max_pairs                 pairs      = 64
+  no_color_video            ncv        = -1
+  buffer_capacity           bufsz      = -1
+  dot_vert_spacing          spinv      = -1
+  dot_horz_spacing          spinh      = -1
+  max_micro_address         maddr      = -1
+  max_micro_jump            mjump      = -1
+  micro_col_size            mcs        = -1
+  micro_line_size           mls        = -1
+  number_of_pins            npins      = -1
+  output_res_char           orc        = -1
+  output_res_line           orl        = -1
+  output_res_horz_inch      orhi       = -1
+  output_res_vert_inch      orvi       = -1
+  print_rate                cps        = -1
+  wide_char_size            widcs      = -1
+  buttons                   btns       = -1
+  bit_image_entwining       bitwin     = -1
+  bit_image_type            bitype     = -1
+  magic_cookie_glitch_ul    OTug       = -1
+  carriage_return_delay     OTdC       = -1
+  new_line_delay            OTdN       = -1
+  backspace_delay           OTdB       = -1
+  horizontal_tab_delay      OTdT       = -1
+  number_of_function_keys   OTkn       = -1
+String capabilities:
+  back_tab                  cbt        = <Esc>[Z
+  bell                      bel        = <C-G>
+  carriage_return           cr         = <CR>
+  change_scroll_region      csr        = <Esc>[%i%p1%d;%p2%dr
+  clear_all_tabs            tbc        = <Esc>[3g
+  clear_screen              clear      = <Esc>[H<Esc>[2J
+  clr_eol                   el         = <Esc>[K
+  clr_eos                   ed         = <Esc>[J
+  column_address            hpa        = <Esc>[%i%p1%dG
+  cursor_address            cup        = <Esc>[%i%p1%d;%p2%dH
+  cursor_down               cud1       = <NL>
+  cursor_home               home       = <Esc>[H
+  cursor_invisible          civis      = <Esc>[?25l
+  cursor_left               cub1       = <C-H>
+  cursor_normal             cnorm      = <Esc>[?25h
+  cursor_right              cuf1       = <Esc>[C
+  cursor_up                 cuu1       = <Esc>[A
+  cursor_visible            cvvis      = <Esc>[?12;25h
+  delete_character          dch1       = <Esc>[P
+  delete_line               dl1        = <Esc>[M
+  enter_alt_charset_mode    smacs      = <Esc>(0
+  enter_blink_mode          blink      = <Esc>[5m
+  enter_bold_mode           bold       = <Esc>[1m
+  enter_ca_mode             smcup      = <Esc>[?1049h
+  enter_dim_mode            dim        = <Esc>[2m
+  enter_insert_mode         smir       = <Esc>[4h
+  enter_secure_mode         invis      = <Esc>[8m
+  enter_reverse_mode        rev        = <Esc>[7m
+  enter_standout_mode       smso       = <Esc>[7m
+  enter_underline_mode      smul       = <Esc>[4m
+  erase_chars               ech        = <Esc>[%p1%dX
+  exit_alt_charset_mode     rmacs      = <Esc>(B
+  exit_attribute_mode       sgr0       = <Esc>(B<Esc>[m
+  exit_ca_mode              rmcup      = <Esc>[?1049l
+  exit_insert_mode          rmir       = <Esc>[4l
+  exit_standout_mode        rmso       = <Esc>[27m
+  exit_underline_mode       rmul       = <Esc>[24m
+  flash_screen              flash      = <Esc>[?5h$<100/><Esc>[?5l
+  from_status_line          fsl        = <C-G>
+  init_2string              is2        = <Esc>[!p<Esc>[?3;4l<Esc>[4l<Esc>>
+  insert_line               il1        = <Esc>[L
+  key_backspace             kbs        = <^?>
+  key_dc                    kdch1      = <Esc>[3~
+  key_down                  kcud1      = <Esc>OB
+  key_f1                    kf1        = <Esc>OP
+  key_f10                   kf10       = <Esc>[21~
+  key_f2                    kf2        = <Esc>OQ
+  key_f3                    kf3        = <Esc>OR
+  key_f4                    kf4        = <Esc>OS
+  key_f5                    kf5        = <Esc>[15~
+  key_f6                    kf6        = <Esc>[17~
+  key_f7                    kf7        = <Esc>[18~
+  key_f8                    kf8        = <Esc>[19~
+  key_f9                    kf9        = <Esc>[20~
+  key_home                  khome      = <Esc>OH
+  key_ic                    kich1      = <Esc>[2~
+  key_left                  kcub1      = <Esc>OD
+  key_npage                 knp        = <Esc>[6~
+  key_ppage                 kpp        = <Esc>[5~
+  key_right                 kcuf1      = <Esc>OC
+  key_sf                    kind       = <Esc>[1;2B
+  key_sr                    kri        = <Esc>[1;2A
+  key_up                    kcuu1      = <Esc>OA
+  keypad_local              rmkx       = <Esc>[?1l<Esc>>
+  keypad_xmit               smkx       = <Esc>[?1h<Esc>=
+  meta_off                  rmm        = <Esc>[?1034l
+  meta_on                   smm        = <Esc>[?1034h
+  parm_dch                  dch        = <Esc>[%p1%dP
+  parm_delete_line          dl         = <Esc>[%p1%dM
+  parm_down_cursor          cud        = <Esc>[%p1%dB
+  parm_ich                  ich        = <Esc>[%p1%d@
+  parm_index                indn       = <Esc>[%p1%dS
+  parm_insert_line          il         = <Esc>[%p1%dL
+  parm_left_cursor          cub        = <Esc>[%p1%dD
+  parm_right_cursor         cuf        = <Esc>[%p1%dC
+  parm_rindex               rin        = <Esc>[%p1%dT
+  parm_up_cursor            cuu        = <Esc>[%p1%dA
+  print_screen              mc0        = <Esc>[i
+  prtr_off                  mc4        = <Esc>[4i
+  prtr_on                   mc5        = <Esc>[5i
+  reset_1string             rs1        = <Esc>c
+  reset_2string             rs2        = <Esc>[!p<Esc>[?3;4l<Esc>[4l<Esc>>
+  restore_cursor            rc         = <Esc>8
+  row_address               vpa        = <Esc>[%i%p1%dd
+  save_cursor               sc         = <Esc>7
+  scroll_forward            ind        = <NL>
+  scroll_reverse            ri         = <Esc>M
+  set_attributes            sgr        = %?%p9%t<Esc>(0%e<Esc>(B%;<Esc>[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m
+  set_tab                   hts        = <Esc>H
+  tab                       ht         = <Tab>
+  to_status_line            tsl        = <Esc>]0;
+  key_b2                    kb2        = <Esc>OE
+  acs_chars                 acsc       = ``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~
+  key_btab                  kcbt       = <Esc>[Z
+  enter_am_mode             smam       = <Esc>[?7h
+  exit_am_mode              rmam       = <Esc>[?7l
+  key_end                   kend       = <Esc>OF
+  key_enter                 kent       = <Esc>OM
+  key_sdc                   kDC        = <Esc>[3;2~
+  key_send                  kEND       = <Esc>[1;2F
+  key_shome                 kHOM       = <Esc>[1;2H
+  key_sic                   kIC        = <Esc>[2;2~
+  key_sleft                 kLFT       = <Esc>[1;2D
+  key_snext                 kNXT       = <Esc>[6;2~
+  key_sprevious             kPRV       = <Esc>[5;2~
+  key_sright                kRIT       = <Esc>[1;2C
+  key_f11                   kf11       = <Esc>[23~
+  key_f12                   kf12       = <Esc>[24~
+  key_f13                   kf13       = <Esc>[1;2P
+  key_f14                   kf14       = <Esc>[1;2Q
+  key_f15                   kf15       = <Esc>[1;2R
+  key_f16                   kf16       = <Esc>[1;2S
+  key_f17                   kf17       = <Esc>[15;2~
+  key_f18                   kf18       = <Esc>[17;2~
+  key_f19                   kf19       = <Esc>[18;2~
+  key_f20                   kf20       = <Esc>[19;2~
+  key_f21                   kf21       = <Esc>[20;2~
+  key_f22                   kf22       = <Esc>[21;2~
+  key_f23                   kf23       = <Esc>[23;2~
+  key_f24                   kf24       = <Esc>[24;2~
+  key_f25                   kf25       = <Esc>[1;5P
+  key_f26                   kf26       = <Esc>[1;5Q
+  key_f27                   kf27       = <Esc>[1;5R
+  key_f28                   kf28       = <Esc>[1;5S
+  key_f29                   kf29       = <Esc>[15;5~
+  key_f30                   kf30       = <Esc>[17;5~
+  key_f31                   kf31       = <Esc>[18;5~
+  key_f32                   kf32       = <Esc>[19;5~
+  key_f33                   kf33       = <Esc>[20;5~
+  key_f34                   kf34       = <Esc>[21;5~
+  key_f35                   kf35       = <Esc>[23;5~
+  key_f36                   kf36       = <Esc>[24;5~
+  key_f37                   kf37       = <Esc>[1;6P
+  key_f38                   kf38       = <Esc>[1;6Q
+  key_f39                   kf39       = <Esc>[1;6R
+  key_f40                   kf40       = <Esc>[1;6S
+  key_f41                   kf41       = <Esc>[15;6~
+  key_f42                   kf42       = <Esc>[17;6~
+  key_f43                   kf43       = <Esc>[18;6~
+  key_f44                   kf44       = <Esc>[19;6~
+  key_f45                   kf45       = <Esc>[20;6~
+  key_f46                   kf46       = <Esc>[21;6~
+  key_f47                   kf47       = <Esc>[23;6~
+  key_f48                   kf48       = <Esc>[24;6~
+  key_f49                   kf49       = <Esc>[1;3P
+  key_f50                   kf50       = <Esc>[1;3Q
+  key_f51                   kf51       = <Esc>[1;3R
+  key_f52                   kf52       = <Esc>[1;3S
+  key_f53                   kf53       = <Esc>[15;3~
+  key_f54                   kf54       = <Esc>[17;3~
+  key_f55                   kf55       = <Esc>[18;3~
+  key_f56                   kf56       = <Esc>[19;3~
+  key_f57                   kf57       = <Esc>[20;3~
+  key_f58                   kf58       = <Esc>[21;3~
+  key_f59                   kf59       = <Esc>[23;3~
+  key_f60                   kf60       = <Esc>[24;3~
+  key_f61                   kf61       = <Esc>[1;4P
+  key_f62                   kf62       = <Esc>[1;4Q
+  key_f63                   kf63       = <Esc>[1;4R
+  clr_bol                   el1        = <Esc>[1K
+  user6                     u6         = <Esc>[%i%d;%dR
+  user7                     u7         = <Esc>[6n
+  user8                     u8         = <Esc>[?%[;0123456789]c
+  user9                     u9         = <Esc>[c
+  orig_pair                 op         = <Esc>[39;49m
+  set_foreground            setf       = <Esc>[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m
+  set_background            setb       = <Esc>[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m
+  enter_italics_mode        sitm       = <Esc>[3m
+  exit_italics_mode         ritm       = <Esc>[23m
+  key_mouse                 kmous      = <Esc>[M
+  set_a_foreground          setaf      = <Esc>[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m
+  set_a_background          setab      = <Esc>[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m
+  set_tb_margin             smgtb      = <Esc>[%i%p1%d;%p2%dr
+  memory_lock               meml       = <Esc>l
+  memory_unlock             memu       = <Esc>m
+Extended boolean capabilities:
+  AX                        = true
+  G0                        = false
+  XT                        = true
+Extended numeric capabilities:
+  U8                        = -1
+Extended string capabilities:
+  Cr                        = <Esc>]112<C-G>
+  Cs                        = <Esc>]12;%p1%s<C-G>
+  E0                        = 
+  E3                        = <Esc>[3J
+  Ms                        = <Esc>]52;%p1%s;%p2%s<C-G>
+  S0                        = 
+  Se                        = <Esc>[2 q
+  Ss                        = <Esc>[%p1%d q
+  TS                        = 
+  kDC3                      = <Esc>[3;3~
+  kDC4                      = <Esc>[3;4~
+  kDC5                      = <Esc>[3;5~
+  kDC6                      = <Esc>[3;6~
+  kDC7                      = <Esc>[3;7~
+  kDN                       = <Esc>[1;2B
+  kDN3                      = <Esc>[1;3B
+  kDN4                      = <Esc>[1;4B
+  kDN5                      = <Esc>[1;5B
+  kDN6                      = <Esc>[1;6B
+  kDN7                      = <Esc>[1;7B
+  kEND3                     = <Esc>[1;3F
+  kEND4                     = <Esc>[1;4F
+  kEND5                     = <Esc>[1;5F
+  kEND6                     = <Esc>[1;6F
+  kEND7                     = <Esc>[1;7F
+  kHOM3                     = <Esc>[1;3H
+  kHOM4                     = <Esc>[1;4H
+  kHOM5                     = <Esc>[1;5H
+  kHOM6                     = <Esc>[1;6H
+  kHOM7                     = <Esc>[1;7H
+  kIC3                      = <Esc>[2;3~
+  kIC4                      = <Esc>[2;4~
+  kIC5                      = <Esc>[2;5~
+  kIC6                      = <Esc>[2;6~
+  kIC7                      = <Esc>[2;7~
+  kLFT3                     = <Esc>[1;3D
+  kLFT4                     = <Esc>[1;4D
+  kLFT5                     = <Esc>[1;5D
+  kLFT6                     = <Esc>[1;6D
+  kLFT7                     = <Esc>[1;7D
+  kNXT3                     = <Esc>[6;3~
+  kNXT4                     = <Esc>[6;4~
+  kNXT5                     = <Esc>[6;5~
+  kNXT6                     = <Esc>[6;6~
+  kNXT7                     = <Esc>[6;7~
+  kPRV3                     = <Esc>[5;3~
+  kPRV4                     = <Esc>[5;4~
+  kPRV5                     = <Esc>[5;5~
+  kPRV6                     = <Esc>[5;6~
+  kPRV7                     = <Esc>[5;7~
+  kRIT3                     = <Esc>[1;3C
+  kRIT4                     = <Esc>[1;4C
+  kRIT5                     = <Esc>[1;5C
+  kRIT6                     = <Esc>[1;6C
+  kRIT7                     = <Esc>[1;7C
+  kUP                       = <Esc>[1;2A
+  kUP3                      = <Esc>[1;3A
+  kUP4                      = <Esc>[1;4A
+  kUP5                      = <Esc>[1;5A
+  kUP6                      = <Esc>[1;6A
+  kUP7                      = <Esc>[1;7A
+  ka2                       = 
+  kb1                       = 
+  kb3                       = 
+  kc2                       = 
+  rmxx                      = <Esc>[29m
+  smxx                      = <Esc>[9m
+  ext.get_bg                = <Esc>]11;?<C-G>
+  ext.resize_screen         = <Esc>[8;%p1%d;%p2%dt
+  ext.reset_scroll_region   = <Esc>[r
+  setrgbf                   = <Esc>[38;2;%p1%d;%p2%d;%p3%dm
+  setrgbb                   = <Esc>[48;2;%p1%d;%p2%d;%p3%dm
   ext.set_cursor_color      = <Esc>]12;#%p1%06x<C-G>
   ext.reset_cursor_color    = <Esc>]112<C-G>
   ext.save_title            = <Esc>[22;0t
```

### Expected behavior

neovim should scroll without visual artifacts regardless of terminal emulator (version).

### Actual behavior

Scrolling a single buffer with `TERM=xterm XTERM_VERSION=XTerm/OpenBSD(369)` effects all vertically adjacent buffers.