Patch 8.1.0514
Problem:    CTRL-W ^ does not work when alternate buffer has no name.
Solution:   Use another method to split and edit the alternate buffer. (Jason
            Franklin)
Files:      src/testdir/test_normal.vim, src/testdir/test_window_cmd.vim,
            src/normal.c, src/window.c, runtime/doc/windows.txt


*** ../vim-8.1.0513/src/testdir/test_normal.vim 2018-09-03 22:08:05.676736128 
+0200
--- src/testdir/test_normal.vim 2018-11-10 15:55:36.238319451 +0100
***************
*** 1,11 ****
  " Test for various Normal mode commands
  
! func! Setup_NewWindow()
    10new
    call setline(1, range(1,100))
  endfunc
  
! func! MyFormatExpr()
    " Adds '->$' at lines having numbers followed by trailing whitespace
    for ln in range(v:lnum, v:lnum+v:count-1)
      let line = getline(ln)
--- 1,11 ----
  " Test for various Normal mode commands
  
! func Setup_NewWindow()
    10new
    call setline(1, range(1,100))
  endfunc
  
! func MyFormatExpr()
    " Adds '->$' at lines having numbers followed by trailing whitespace
    for ln in range(v:lnum, v:lnum+v:count-1)
      let line = getline(ln)
***************
*** 15,21 ****
    endfor
  endfunc
  
! func! CountSpaces(type, ...)
    " for testing operatorfunc
    " will count the number of spaces
    " and return the result in g:a
--- 15,21 ----
    endfor
  endfunc
  
! func CountSpaces(type, ...)
    " for testing operatorfunc
    " will count the number of spaces
    " and return the result in g:a
***************
*** 35,41 ****
    let @@ = reg_save
  endfunc
  
! func! OpfuncDummy(type, ...)
    " for testing operatorfunc
    let g:opt=&linebreak
  
--- 35,41 ----
    let @@ = reg_save
  endfunc
  
! func OpfuncDummy(type, ...)
    " for testing operatorfunc
    let g:opt=&linebreak
  
***************
*** 78,84 ****
    bw!
  endfunc
  
! func! Test_normal01_keymodel()
    call Setup_NewWindow()
    " Test 1: depending on 'keymodel' <s-down> does something different
    50
--- 78,84 ----
    bw!
  endfunc
  
! func Test_normal01_keymodel()
    call Setup_NewWindow()
    " Test 1: depending on 'keymodel' <s-down> does something different
    50
***************
*** 112,118 ****
    bw!
  endfunc
  
! func! Test_normal02_selectmode()
    " some basic select mode tests
    call Setup_NewWindow()
    50
--- 112,118 ----
    bw!
  endfunc
  
! func Test_normal02_selectmode()
    " some basic select mode tests
    call Setup_NewWindow()
    50
***************
*** 126,132 ****
    bw!
  endfunc
  
! func! Test_normal02_selectmode2()
    " some basic select mode tests
    call Setup_NewWindow()
    50
--- 126,132 ----
    bw!
  endfunc
  
! func Test_normal02_selectmode2()
    " some basic select mode tests
    call Setup_NewWindow()
    50
***************
*** 136,142 ****
    bw!
  endfunc
  
! func! Test_normal03_join()
    " basic join test
    call Setup_NewWindow()
    50
--- 136,142 ----
    bw!
  endfunc
  
! func Test_normal03_join()
    " basic join test
    call Setup_NewWindow()
    50
***************
*** 156,162 ****
    bw!
  endfunc
  
! func! Test_normal04_filter()
    " basic filter test
    " only test on non windows platform
    if has('win32')
--- 156,162 ----
    bw!
  endfunc
  
! func Test_normal04_filter()
    " basic filter test
    " only test on non windows platform
    if has('win32')
***************
*** 182,188 ****
    bw!
  endfunc
  
! func! Test_normal05_formatexpr()
    " basic formatexpr test
    call Setup_NewWindow()
    %d_
--- 182,188 ----
    bw!
  endfunc
  
! func Test_normal05_formatexpr()
    " basic formatexpr test
    call Setup_NewWindow()
    %d_
***************
*** 219,225 ****
    set formatexpr=
  endfunc
  
! func! Test_normal06_formatprg()
    " basic test for formatprg
    " only test on non windows platform
    if has('win32')
--- 219,225 ----
    set formatexpr=
  endfunc
  
! func Test_normal06_formatprg()
    " basic test for formatprg
    " only test on non windows platform
    if has('win32')
***************
*** 253,259 ****
    call delete('Xsed_format.sh')
  endfunc
  
! func! Test_normal07_internalfmt()
    " basic test for internal formmatter to textwidth of 12
    let list=range(1,11)
    call map(list, 'v:val."    "')
--- 253,259 ----
    call delete('Xsed_format.sh')
  endfunc
  
! func Test_normal07_internalfmt()
    " basic test for internal formmatter to textwidth of 12
    let list=range(1,11)
    call map(list, 'v:val."    "')
***************
*** 267,273 ****
    bw!
  endfunc
  
! func! Test_normal08_fold()
    " basic tests for foldopen/folddelete
    if !has("folding")
      return
--- 267,273 ----
    bw!
  endfunc
  
! func Test_normal08_fold()
    " basic tests for foldopen/folddelete
    if !has("folding")
      return
***************
*** 326,332 ****
    bw!
  endfunc
  
! func! Test_normal09_operatorfunc()
    " Test operatorfunc
    call Setup_NewWindow()
    " Add some spaces for counting
--- 326,332 ----
    bw!
  endfunc
  
! func Test_normal09_operatorfunc()
    " Test operatorfunc
    call Setup_NewWindow()
    " Add some spaces for counting
***************
*** 356,362 ****
    bw!
  endfunc
  
! func! Test_normal09a_operatorfunc()
    " Test operatorfunc
    call Setup_NewWindow()
    " Add some spaces for counting
--- 356,362 ----
    bw!
  endfunc
  
! func Test_normal09a_operatorfunc()
    " Test operatorfunc
    call Setup_NewWindow()
    " Add some spaces for counting
***************
*** 382,388 ****
    unlet! g:opt
  endfunc
  
! func! Test_normal10_expand()
    " Test for expand()
    10new
    call setline(1, ['1', 'ifooar,,cbar'])
--- 382,388 ----
    unlet! g:opt
  endfunc
  
! func Test_normal10_expand()
    " Test for expand()
    10new
    call setline(1, ['1', 'ifooar,,cbar'])
***************
*** 417,423 ****
    bw!
  endfunc
  
! func! Test_normal11_showcmd()
    " test for 'showcmd'
    10new
    exe "norm! ofoobar\<esc>"
--- 417,423 ----
    bw!
  endfunc
  
! func Test_normal11_showcmd()
    " test for 'showcmd'
    10new
    exe "norm! ofoobar\<esc>"
***************
*** 432,438 ****
    bw!
  endfunc
  
! func! Test_normal12_nv_error()
    " Test for nv_error
    10new
    call setline(1, range(1,5))
--- 432,438 ----
    bw!
  endfunc
  
! func Test_normal12_nv_error()
    " Test for nv_error
    10new
    call setline(1, range(1,5))
***************
*** 442,448 ****
    bw!
  endfunc
  
! func! Test_normal13_help()
    " Test for F1
    call assert_equal(1, winnr())
    call feedkeys("\<f1>", 'txi')
--- 442,448 ----
    bw!
  endfunc
  
! func Test_normal13_help()
    " Test for F1
    call assert_equal(1, winnr())
    call feedkeys("\<f1>", 'txi')
***************
*** 451,457 ****
    bw!
  endfunc
  
! func! Test_normal14_page()
    " basic test for Ctrl-F and Ctrl-B
    call Setup_NewWindow()
    exe "norm! \<c-f>"
--- 451,457 ----
    bw!
  endfunc
  
! func Test_normal14_page()
    " basic test for Ctrl-F and Ctrl-B
    call Setup_NewWindow()
    exe "norm! \<c-f>"
***************
*** 485,491 ****
    bw!
  endfunc
  
! func! Test_normal14_page_eol()
    10new
    norm oxxxxxxx
    exe "norm 2\<c-f>"
--- 485,491 ----
    bw!
  endfunc
  
! func Test_normal14_page_eol()
    10new
    norm oxxxxxxx
    exe "norm 2\<c-f>"
***************
*** 494,500 ****
    bw!
  endfunc
  
! func! Test_normal15_z_scroll_vert()
    " basic test for z commands that scroll the window
    call Setup_NewWindow()
    100
--- 494,500 ----
    bw!
  endfunc
  
! func Test_normal15_z_scroll_vert()
    " basic test for z commands that scroll the window
    call Setup_NewWindow()
    100
***************
*** 583,589 ****
    bw!
  endfunc
  
! func! Test_normal16_z_scroll_hor()
    " basic test for z commands that scroll the window
    10new
    15vsp
--- 583,589 ----
    bw!
  endfunc
  
! func Test_normal16_z_scroll_hor()
    " basic test for z commands that scroll the window
    10new
    15vsp
***************
*** 649,655 ****
    bw!
  endfunc
  
! func! Test_normal17_z_scroll_hor2()
    " basic test for z commands that scroll the window
    " using 'sidescrolloff' setting
    10new
--- 649,655 ----
    bw!
  endfunc
  
! func Test_normal17_z_scroll_hor2()
    " basic test for z commands that scroll the window
    " using 'sidescrolloff' setting
    10new
***************
*** 716,722 ****
    bw!
  endfunc
  
! func! Test_normal18_z_fold()
    " basic tests for foldopen/folddelete
    if !has("folding")
      return
--- 716,722 ----
    bw!
  endfunc
  
! func Test_normal18_z_fold()
    " basic tests for foldopen/folddelete
    if !has("folding")
      return
***************
*** 1087,1093 ****
    bw!
  endfunc
  
! func! Test_normal19_z_spell()
    if !has("spell") || !has('syntax')
      return
    endif
--- 1087,1093 ----
    bw!
  endfunc
  
! func Test_normal19_z_spell()
    if !has("spell") || !has('syntax')
      return
    endif
***************
*** 1241,1247 ****
    bw!
  endfunc
  
! func! Test_normal20_exmode()
    if !has("unix")
      " Reading from redirected file doesn't work on MS-Windows
      return
--- 1241,1247 ----
    bw!
  endfunc
  
! func Test_normal20_exmode()
    if !has("unix")
      " Reading from redirected file doesn't work on MS-Windows
      return
***************
*** 1259,1282 ****
    bw!
  endfunc
  
! func! Test_normal21_nv_hat()
!   set hidden
!   new
!   " to many buffers opened already, will not work
!   "call assert_fails(":b#", 'E23')
!   "call assert_equal('', @#)
!   e Xfoobar
!   e Xfile2
!   call feedkeys("\<c-^>", 't')
!   call assert_equal("Xfile2", fnamemodify(bufname('%'), ':t'))
!   call feedkeys("f\<c-^>", 't')
!   call assert_equal("Xfile2", fnamemodify(bufname('%'), ':t'))
!   " clean up
!   set nohidden
!   bw!
  endfunc
  
! func! Test_normal22_zet()
    " Test for ZZ
    " let shell = &shell
    " let &shell = 'sh'
--- 1259,1296 ----
    bw!
  endfunc
  
! func Test_normal21_nv_hat()
! 
!   " Edit a fresh file and wipe the buffer list so that there is no alternate
!   " file present.  Next, check for the expected command failures.
!   edit Xfoo | %bw
!   call assert_fails(':buffer #', 'E86')
!   call assert_fails(':execute "normal! \<C-^>"', 'E23')
! 
!   " Test for the expected behavior when switching between two named buffers.
!   edit Xfoo | edit Xbar
!   call feedkeys("\<C-^>", 'tx')
!   call assert_equal('Xfoo', fnamemodify(bufname('%'), ':t'))
!   call feedkeys("\<C-^>", 'tx')
!   call assert_equal('Xbar', fnamemodify(bufname('%'), ':t'))
! 
!   " Test for the expected behavior when only one buffer is named.
!   enew | let l:nr = bufnr('%')
!   call feedkeys("\<C-^>", 'tx')
!   call assert_equal('Xbar', fnamemodify(bufname('%'), ':t'))
!   call feedkeys("\<C-^>", 'tx')
!   call assert_equal('', bufname('%'))
!   call assert_equal(l:nr, bufnr('%'))
! 
!   " Test that no action is taken by "<C-^>" when an operator is pending.
!   edit Xfoo
!   call feedkeys("ci\<C-^>", 'tx')
!   call assert_equal('Xfoo', fnamemodify(bufname('%'), ':t'))
! 
!   %bw!
  endfunc
  
! func Test_normal22_zet()
    " Test for ZZ
    " let shell = &shell
    " let &shell = 'sh'
***************
*** 1298,1304 ****
    " let &shell = shell
  endfunc
  
! func! Test_normal23_K()
    " Test for K command
    new
    call append(0, ['version8.txt', 'man', 'aa%bb', 'cc|dd'])
--- 1312,1318 ----
    " let &shell = shell
  endfunc
  
! func Test_normal23_K()
    " Test for K command
    new
    call append(0, ['version8.txt', 'man', 'aa%bb', 'cc|dd'])
***************
*** 1353,1359 ****
    bw!
  endfunc
  
! func! Test_normal24_rot13()
    " This test uses multi byte characters
    if !has("multi_byte")
      return
--- 1367,1373 ----
    bw!
  endfunc
  
! func Test_normal24_rot13()
    " This test uses multi byte characters
    if !has("multi_byte")
      return
***************
*** 1371,1377 ****
    bw!
  endfunc
  
! func! Test_normal25_tag()
    " Testing for CTRL-] g CTRL-] g]
    " CTRL-W g] CTRL-W CTRL-] CTRL-W g CTRL-]
    h
--- 1385,1391 ----
    bw!
  endfunc
  
! func Test_normal25_tag()
    " Testing for CTRL-] g CTRL-] g]
    " CTRL-W g] CTRL-W CTRL-] CTRL-W g CTRL-]
    h
***************
*** 1438,1444 ****
    helpclose
  endfunc
  
! func! Test_normal26_put()
    " Test for ]p ]P [p and [P
    new
    call append(0, ['while read LINE', 'do', '  ((count++))', '  if [ $? -ne 0 
]; then', "    echo 'Error writing file'", '  fi', 'done'])
--- 1452,1458 ----
    helpclose
  endfunc
  
! func Test_normal26_put()
    " Test for ]p ]P [p and [P
    new
    call append(0, ['while read LINE', 'do', '  ((count++))', '  if [ $? -ne 0 
]; then', "    echo 'Error writing file'", '  fi', 'done'])
***************
*** 1457,1463 ****
    bw!
  endfunc
  
! func! Test_normal27_bracket()
    " Test for [' [` ]' ]`
    call Setup_NewWindow()
    1,21s/.\+/  &   b/
--- 1471,1477 ----
    bw!
  endfunc
  
! func Test_normal27_bracket()
    " Test for [' [` ]' ]`
    call Setup_NewWindow()
    1,21s/.\+/  &   b/
***************
*** 1508,1514 ****
    bw!
  endfunc
  
! func! Test_normal28_parenthesis()
    " basic testing for ( and )
    new
    call append(0, ['This is a test. With some sentences!', '', 'Even with a 
question? And one more. And no sentence here'])
--- 1522,1528 ----
    bw!
  endfunc
  
! func Test_normal28_parenthesis()
    " basic testing for ( and )
    new
    call append(0, ['This is a test. With some sentences!', '', 'Even with a 
question? And one more. And no sentence here'])
***************
*** 1705,1711 ****
    bw!
  endfunc
  
! func! Test_normal32_g_cmd1()
    " Test for g*, g#
    new
    call append(0, ['abc.x_foo', 'x_foobar.abc'])
--- 1719,1725 ----
    bw!
  endfunc
  
! func Test_normal32_g_cmd1()
    " Test for g*, g#
    new
    call append(0, ['abc.x_foo', 'x_foobar.abc'])
***************
*** 1836,1842 ****
    bw!
  endfunc
  
! func! Test_g_ctrl_g()
    new
  
    let a = execute(":norm! g\<c-g>")
--- 1850,1856 ----
    bw!
  endfunc
  
! func Test_g_ctrl_g()
    new
  
    let a = execute(":norm! g\<c-g>")
***************
*** 2134,2140 ****
    bw!
  endfunc
  
! func! Test_normal42_halfpage()
    " basic test for Ctrl-D and Ctrl-U
    call Setup_NewWindow()
    call assert_equal(5, &scroll)
--- 2148,2154 ----
    bw!
  endfunc
  
! func Test_normal42_halfpage()
    " basic test for Ctrl-D and Ctrl-U
    call Setup_NewWindow()
    call assert_equal(5, &scroll)
***************
*** 2202,2208 ****
    bw!
  endfunc
  
! func! Test_normal44_textobjects2()
    " basic testing for is and as text objects
    new
    call append(0, ['This is a test. With some sentences!', '', 'Even with a 
question? And one more. And no sentence here'])
--- 2216,2222 ----
    bw!
  endfunc
  
! func Test_normal44_textobjects2()
    " basic testing for is and as text objects
    new
    call append(0, ['This is a test. With some sentences!', '', 'Even with a 
question? And one more. And no sentence here'])
***************
*** 2257,2263 ****
    bw!
  endfunc
  
! func! Test_normal45_drop()
    if !has('dnd')
      " The ~ register does not exist
      call assert_beeps('norm! "~')
--- 2271,2277 ----
    bw!
  endfunc
  
! func Test_normal45_drop()
    if !has('dnd')
      " The ~ register does not exist
      call assert_beeps('norm! "~')
***************
*** 2275,2281 ****
    bw!
  endfunc
  
! func! Test_normal46_ignore()
    " This test uses multi byte characters
    if !has("multi_byte")
      return
--- 2289,2295 ----
    bw!
  endfunc
  
! func Test_normal46_ignore()
    " This test uses multi byte characters
    if !has("multi_byte")
      return
***************
*** 2299,2305 ****
    bw!
  endfunc
  
! func! Test_normal47_visual_buf_wipe()
    " This was causing a crash or ml_get error.
    enew!
    call setline(1,'xxx')
--- 2313,2319 ----
    bw!
  endfunc
  
! func Test_normal47_visual_buf_wipe()
    " This was causing a crash or ml_get error.
    enew!
    call setline(1,'xxx')
***************
*** 2313,2319 ****
    set nomodified
  endfunc
  
! func! Test_normal47_autocmd()
    " disabled, does not seem to be possible currently
    throw "Skipped: not possible to test cursorhold autocmd while waiting for 
input in normal_cmd"
    new
--- 2327,2333 ----
    set nomodified
  endfunc
  
! func Test_normal47_autocmd()
    " disabled, does not seem to be possible currently
    throw "Skipped: not possible to test cursorhold autocmd while waiting for 
input in normal_cmd"
    new
***************
*** 2331,2344 ****
    bw!
  endfunc
  
! func! Test_normal48_wincmd()
    new
    exe "norm! \<c-w>c"
    call assert_equal(1, winnr('$'))
    call assert_fails(":norm! \<c-w>c", "E444")
  endfunc
  
! func! Test_normal49_counts()
    new
    call setline(1, 'one two three four five six seven eight nine ten')
    1
--- 2345,2358 ----
    bw!
  endfunc
  
! func Test_normal48_wincmd()
    new
    exe "norm! \<c-w>c"
    call assert_equal(1, winnr('$'))
    call assert_fails(":norm! \<c-w>c", "E444")
  endfunc
  
! func Test_normal49_counts()
    new
    call setline(1, 'one two three four five six seven eight nine ten')
    1
***************
*** 2347,2353 ****
    bw!
  endfunc
  
! func! Test_normal50_commandline()
    if !has("timers") || !has("cmdline_hist")
      return
    endif
--- 2361,2367 ----
    bw!
  endfunc
  
! func Test_normal50_commandline()
    if !has("timers") || !has("cmdline_hist")
      return
    endif
***************
*** 2378,2384 ****
    bw!
  endfunc
  
! func! Test_normal51_FileChangedRO()
    if !has("autocmd")
      return
    endif
--- 2392,2398 ----
    bw!
  endfunc
  
! func Test_normal51_FileChangedRO()
    if !has("autocmd")
      return
    endif
***************
*** 2398,2404 ****
    call delete("Xreadonly.log")
  endfunc
  
! func! Test_normal52_rl()
    if !has("rightleft")
      return
    endif
--- 2412,2418 ----
    call delete("Xreadonly.log")
  endfunc
  
! func Test_normal52_rl()
    if !has("rightleft")
      return
    endif
***************
*** 2431,2437 ****
    bw!
  endfunc
  
! func! Test_normal53_digraph()
    if !has('digraphs')
      return
    endif
--- 2445,2451 ----
    bw!
  endfunc
  
! func Test_normal53_digraph()
    if !has('digraphs')
      return
    endif
***************
*** 2532,2534 ****
--- 2546,2571 ----
    %bwipe!
    let &ul = save_ul
  endfunc
+ 
+ func Test_nv_hat_count()
+   %bwipeout!
+   let l:nr = bufnr('%') + 1
+   call assert_fails(':execute "normal! ' . l:nr . '\<C-^>"', 'E92')
+ 
+   edit Xfoo
+   let l:foo_nr = bufnr('Xfoo')
+ 
+   edit Xbar
+   let l:bar_nr = bufnr('Xbar')
+ 
+   " Make sure we are not just using the alternate file.
+   edit Xbaz
+ 
+   call feedkeys(l:foo_nr . "\<C-^>", 'tx')
+   call assert_equal('Xfoo', fnamemodify(bufname('%'), ':t'))
+ 
+   call feedkeys(l:bar_nr . "\<C-^>", 'tx')
+   call assert_equal('Xbar', fnamemodify(bufname('%'), ':t'))
+ 
+   %bwipeout!
+ endfunc
*** ../vim-8.1.0513/src/testdir/test_window_cmd.vim     2018-05-10 
18:19:36.000000000 +0200
--- src/testdir/test_window_cmd.vim     2018-11-10 15:47:05.614643165 +0100
***************
*** 103,117 ****
    bw
  endfunc
  
  func Test_window_split_edit_alternate()
-   e Xa
-   e Xb
  
    wincmd ^
!   call assert_equal('Xa', bufname(winbufnr(1)))
!   call assert_equal('Xb', bufname(winbufnr(2)))
  
!   bw Xa Xb
  endfunc
  
  func Test_window_preview()
--- 103,167 ----
    bw
  endfunc
  
+ " Test the ":wincmd ^" and "<C-W>^" commands.
  func Test_window_split_edit_alternate()
  
+   " Test for failure when the alternate buffer/file no longer exists.
+   edit Xfoo | %bw
+   call assert_fails(':wincmd ^', 'E23')
+ 
+   " Test for the expected behavior when we have two named buffers.
+   edit Xfoo | edit Xbar
    wincmd ^
!   call assert_equal('Xfoo', bufname(winbufnr(1)))
!   call assert_equal('Xbar', bufname(winbufnr(2)))
!   only
! 
!   " Test for the expected behavior when the alternate buffer is not named.
!   enew | let l:nr1 = bufnr('%')
!   edit Xfoo | let l:nr2 = bufnr('%')
!   wincmd ^
!   call assert_equal(l:nr1, winbufnr(1))
!   call assert_equal(l:nr2, winbufnr(2))
!   only
! 
!   " Test the Normal mode command.
!   call feedkeys("\<C-W>\<C-^>", 'tx')
!   call assert_equal(l:nr2, winbufnr(1))
!   call assert_equal(l:nr1, winbufnr(2))
! 
!   %bw!
! endfunc
! 
! " Test the ":[count]wincmd ^" and "[count]<C-W>^" commands.
! func Test_window_split_edit_bufnr()
! 
!   %bwipeout
!   let l:nr = bufnr('%') + 1
!   call assert_fails(':execute "normal! ' . l:nr . '\<C-W>\<C-^>"', 'E92')
!   call assert_fails(':' . l:nr . 'wincmd ^', 'E16')
!   call assert_fails(':0wincmd ^', 'E16')
! 
!   edit Xfoo | edit Xbar | edit Xbaz
!   let l:foo_nr = bufnr('Xfoo')
!   let l:bar_nr = bufnr('Xbar')
!   let l:baz_nr = bufnr('Xbaz')
! 
!   call feedkeys(l:foo_nr . "\<C-W>\<C-^>", 'tx')
!   call assert_equal('Xfoo', bufname(winbufnr(1)))
!   call assert_equal('Xbaz', bufname(winbufnr(2)))
!   only
! 
!   call feedkeys(l:bar_nr . "\<C-W>\<C-^>", 'tx')
!   call assert_equal('Xbar', bufname(winbufnr(1)))
!   call assert_equal('Xfoo', bufname(winbufnr(2)))
!   only
! 
!   execute l:baz_nr . 'wincmd ^'
!   call assert_equal('Xbaz', bufname(winbufnr(1)))
!   call assert_equal('Xbar', bufname(winbufnr(2)))
  
!   %bw!
  endfunc
  
  func Test_window_preview()
***************
*** 322,328 ****
    set equalalways
    vsplit
    windo split
!   split 
    wincmd J
    " now we have a frame top-left with two windows, a frame top-right with two
    " windows and a frame at the bottom, full-width.
--- 372,378 ----
    set equalalways
    vsplit
    windo split
!   split
    wincmd J
    " now we have a frame top-left with two windows, a frame top-right with two
    " windows and a frame at the bottom, full-width.
*** ../vim-8.1.0513/src/normal.c        2018-09-30 21:43:17.199693265 +0200
--- src/normal.c        2018-11-10 15:47:05.610643198 +0100
***************
*** 5496,5502 ****
  }
  
  /*
!  * CTRL-^ command, short for ":e #"
   */
      static void
  nv_hat(cmdarg_T *cap)
--- 5496,5503 ----
  }
  
  /*
!  * CTRL-^ command, short for ":e #".  Works even when the alternate buffer is
!  * not named.
   */
      static void
  nv_hat(cmdarg_T *cap)
*** ../vim-8.1.0513/src/window.c        2018-09-30 21:43:17.207693209 +0200
--- src/window.c        2018-11-10 15:53:58.843143892 +0100
***************
*** 151,158 ****
      case '^':
                CHECK_CMDWIN;
                reset_VIsual_and_resel();       /* stop Visual mode */
!               cmd_with_count("split #", cbuf, sizeof(cbuf), Prenum);
!               do_cmdline_cmd(cbuf);
                break;
  
  /* open new window */
--- 151,171 ----
      case '^':
                CHECK_CMDWIN;
                reset_VIsual_and_resel();       /* stop Visual mode */
! 
!               if (buflist_findnr(Prenum == 0
!                                       ? curwin->w_alt_fnum : Prenum) == NULL)
!               {
!                   if (Prenum == 0)
!                       EMSG(_(e_noalt));
!                   else
!                       EMSGN(_("E92: Buffer %ld not found"), Prenum);
!                   break;
!               }
! 
!               if (!curbuf_locked() && win_split(0, 0) == OK)
!                   (void)buflist_getfile(
!                           Prenum == 0 ? curwin->w_alt_fnum : Prenum,
!                           (linenr_T)0, GETF_ALT, FALSE);
                break;
  
  /* open new window */
*** ../vim-8.1.0513/runtime/doc/windows.txt     2018-05-17 13:42:04.000000000 
+0200
--- runtime/doc/windows.txt     2018-11-10 15:47:05.614643165 +0100
***************
*** 81,86 ****
--- 81,90 ----
  functions can be used to convert between the window/tab number and the
  identifier.  There is also the window number, which may change whenever
  windows are opened or closed, see |winnr()|.
+ The window number is only valid in one specific tab.  The window ID is valid
+ across tabs.  For most functions that take a window ID or a window number, the
+ window number only applies to the current tab, while the window ID can refer
+ to a window in any tab.
  
  Each buffer has a unique number and the number will not change within a Vim
  session.  The |bufnr()| and |bufname()| functions can be used to convert
***************
*** 218,231 ****
                |:find|.  Doesn't split if {file} is not found.
  
  CTRL-W CTRL-^                                 *CTRL-W_CTRL-^* *CTRL-W_^*
! CTRL-W ^      Does ":split #", split window in two and edit alternate file.
!               When a count is given, it becomes ":split #N", split window
!               and edit buffer N.
  
                                                *CTRL-W_:*
! CTRL-W :      Does the same as typing |:| : edit a command line.  Useful in a
                terminal window, where all Vim commands must be preceded with
!               CTRL-W or 'termkey'.
  
  Note that the 'splitbelow' and 'splitright' options influence where a new
  window will appear.
--- 222,237 ----
                |:find|.  Doesn't split if {file} is not found.
  
  CTRL-W CTRL-^                                 *CTRL-W_CTRL-^* *CTRL-W_^*
! CTRL-W ^      Split the current window in two and edit the alternate file.
!               When a count N is given, split the current window and edit
!               buffer N.  Similar to ":sp #" and ":sp #N", but it allows the
!               other buffer to be unnamed.  This command matches the behavior
!               of |CTRL-^|, except that it splits a window first.
  
                                                *CTRL-W_:*
! CTRL-W :      Does the same as typing |:| - enter a command line.  Useful in a
                terminal window, where all Vim commands must be preceded with
!               CTRL-W or 'termwinkey'.
  
  Note that the 'splitbelow' and 'splitright' options influence where a new
  window will appear.
*** ../vim-8.1.0513/src/version.c       2018-11-05 21:21:29.800286334 +0100
--- src/version.c       2018-11-10 15:49:12.537568074 +0100
***************
*** 794,795 ****
--- 794,797 ----
  {   /* Add new patch number below this line */
+ /**/
+     514,
  /**/

-- 
The question is:  What do you do with your life?
The wrong answer is: Become the richest guy in the graveyard.
                                (billionaire and Oracle founder Larry Ellison)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui