changeset 30618:c2031ad5ed54 v9.0.0644

patch 9.0.0644: 'smoothscroll' is not copied to a new window on :split Commit: https://github.com/vim/vim/commit/b1fd26d208aadc96d3e8b9215f761150f40a9f91 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Oct 3 11:23:02 2022 +0100 patch 9.0.0644: 'smoothscroll' is not copied to a new window on :split Problem: 'smoothscroll' is not copied to a new window on :split. Solution: Copy the option value. Add a test.
author Bram Moolenaar <Bram@vim.org>
date Mon, 03 Oct 2022 12:30:11 +0200
parents a8e000dc6bf9
children c25742e02de9
files src/option.c src/testdir/test_options.vim src/version.c
diffstat 3 files changed, 106 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/option.c
+++ b/src/option.c
@@ -5679,6 +5679,7 @@ copy_winopt(winopt_T *from, winopt_T *to
     to->wo_wcr = copy_option_val(from->wo_wcr);
     to->wo_scb = from->wo_scb;
     to->wo_scb_save = from->wo_scb_save;
+    to->wo_sms = from->wo_sms;
     to->wo_crb = from->wo_crb;
     to->wo_crb_save = from->wo_crb_save;
 #ifdef FEAT_SPELL
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -721,7 +721,7 @@ func Test_backupskip()
   let &backupskip = backupskip
 endfunc
 
-func Test_copy_winopt()
+func Test_buf_copy_winopt()
   set hidden
 
   " Test copy option from current buffer in window
@@ -775,6 +775,108 @@ func Test_copy_winopt()
   set hidden&
 endfunc
 
+def Test_split_copy_options()
+  var values = [
+    ['cursorbind', true, false],
+    ['fillchars', '"vert:-"', '"' .. &fillchars .. '"'],
+    ['list', true, 0],
+    ['listchars', '"space:-"', '"' .. &listchars .. '"'],
+    ['number', true, 0],
+    ['relativenumber', true, false],
+    ['scrollbind', true, false],
+    ['smoothscroll', true, false],
+    ['virtualedit', '"block"', '"' .. &virtualedit .. '"'],
+    ['wincolor', '"Search"', '"' .. &wincolor .. '"'],
+    ['wrap', false, true],
+  ]
+  if has('linebreak')
+    values += [
+      ['breakindent', true, false],
+      ['breakindentopt', '"min:5"', '"' .. &breakindentopt .. '"'],
+      ['linebreak', true, false],
+      ['numberwidth', 7, 4],
+      ['showbreak', '"++"', '"' .. &showbreak .. '"'],
+    ]
+  endif
+  if has('rightleft')
+    values += [
+      ['rightleft', true, false],
+      ['rightleftcmd', '"search"', '"' .. &rightleftcmd .. '"'],
+    ]
+  endif
+  if has('statusline')
+    values += [
+      ['statusline', '"---%f---"', '"' .. &statusline .. '"'],
+    ]
+  endif
+  if has('spell')
+    values += [
+      ['spell', true, false],
+    ]
+  endif
+  if has('syntax')
+    values += [
+      ['cursorcolumn', true, false],
+      ['cursorline', true, false],
+      ['cursorlineopt', '"screenline"', '"' .. &cursorlineopt .. '"'],
+      ['colorcolumn', '"+1"', '"' .. &colorcolumn .. '"'],
+    ]
+  endif
+  if has('diff')
+    values += [
+      ['diff', true, false],
+    ]
+  endif
+  if has('conceal')
+    values += [
+      ['concealcursor', '"nv"', '"' .. &concealcursor .. '"'],
+      ['conceallevel', '3', &conceallevel],
+    ]
+  endif
+  if has('terminal')
+    values += [
+      ['termwinkey', '"<C-X>"', '"' .. &termwinkey .. '"'],
+      ['termwinsize', '"10x20"', '"' .. &termwinsize .. '"'],
+    ]
+  endif
+  if has('folding')
+    values += [
+      ['foldcolumn', 5,  &foldcolumn],
+      ['foldenable', false, true],
+      ['foldexpr', '"2 + 3"', '"' .. &foldexpr .. '"'],
+      ['foldignore', '"+="', '"' .. &foldignore .. '"'],
+      ['foldlevel', 4,  &foldlevel],
+      ['foldmarker', '">>,<<"', '"' .. &foldmarker .. '"'],
+      ['foldmethod', '"marker"', '"' .. &foldmethod .. '"'],
+      ['foldminlines', 3,  &foldminlines],
+      ['foldnestmax', 17,  &foldnestmax],
+      ['foldtext', '"closed"', '"' .. &foldtext .. '"'],
+    ]
+  endif
+  if has('signs')
+    values += [
+      ['signcolumn', '"number"', '"' .. &signcolumn .. '"'],
+    ]
+  endif
+
+  # set options to non-default value
+  for item in values
+    exe $'&l:{item[0]} = {item[1]}'
+  endfor
+
+  # check values are set in new window
+  split
+  for item in values
+    exe $'assert_equal({item[1]}, &{item[0]}, "{item[0]}")'
+  endfor
+
+  # restore
+  close
+  for item in values
+    exe $'&l:{item[0]} = {item[2]}'
+  endfor
+enddef
+
 func Test_shortmess_F()
   new
   call assert_match('\[No Name\]', execute('file'))
--- a/src/version.c
+++ b/src/version.c
@@ -700,6 +700,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    644,
+/**/
     643,
 /**/
     642,