comparison src/testdir/test_window_cmd.vim @ 32072:b232759b29c8 v9.0.1367

patch 9.0.1367: divide by zero in zero-width window Commit: https://github.com/vim/vim/commit/e0f869196930ef5f25a0ac41c9215b09c9ce2d3c Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 1 17:55:31 2023 +0000 patch 9.0.1367: divide by zero in zero-width window Problem: Divide by zero in zero-width window. Solution: Check the width is positive.
author Bram Moolenaar <Bram@vim.org>
date Wed, 01 Mar 2023 19:00:05 +0100
parents 9460e6b656ca
children 23d44be6ec20
comparison
equal deleted inserted replaced
32071:a5a0cf4b134a 32072:b232759b29c8
1770 set equalalways& 1770 set equalalways&
1771 set splitkeep& 1771 set splitkeep&
1772 let &t_WS = save_WS 1772 let &t_WS = save_WS
1773 endfunc 1773 endfunc
1774 1774
1775 function Test_splitkeep_cmdwin_cursor_position() 1775 func Test_splitkeep_cmdwin_cursor_position()
1776 set splitkeep=screen 1776 set splitkeep=screen
1777 call setline(1, range(&lines)) 1777 call setline(1, range(&lines))
1778 1778
1779 " No scroll when cursor is at near bottom of window and cusor position 1779 " No scroll when cursor is at near bottom of window and cusor position
1780 " recompution (done by line('w0') in this test) happens while in cmdwin. 1780 " recompution (done by line('w0') in this test) happens while in cmdwin.
1795 call assert_equal(1, line('.')) 1795 call assert_equal(1, line('.'))
1796 call assert_equal(1, col('.')) 1796 call assert_equal(1, col('.'))
1797 1797
1798 %bwipeout! 1798 %bwipeout!
1799 set splitkeep& 1799 set splitkeep&
1800 endfunction 1800 endfunc
1801 1801
1802 function Test_splitkeep_misc() 1802 func Test_splitkeep_misc()
1803 set splitkeep=screen 1803 set splitkeep=screen
1804 set splitbelow 1804 set splitbelow
1805 1805
1806 call setline(1, range(1, &lines)) 1806 call setline(1, range(1, &lines))
1807 norm Gzz 1807 norm Gzz
1830 %bwipeout! 1830 %bwipeout!
1831 set splitbelow& 1831 set splitbelow&
1832 set splitkeep& 1832 set splitkeep&
1833 endfunc 1833 endfunc
1834 1834
1835 function Test_splitkeep_callback() 1835 func Test_splitkeep_callback()
1836 CheckScreendump 1836 CheckScreendump
1837 let lines =<< trim END 1837 let lines =<< trim END
1838 set splitkeep=screen 1838 set splitkeep=screen
1839 call setline(1, range(&lines)) 1839 call setline(1, range(&lines))
1840 function C1(a, b) 1840 function C1(a, b)
1863 call VerifyScreenDump(buf, 'Test_splitkeep_callback_4', {}) 1863 call VerifyScreenDump(buf, 'Test_splitkeep_callback_4', {})
1864 1864
1865 call StopVimInTerminal(buf) 1865 call StopVimInTerminal(buf)
1866 endfunc 1866 endfunc
1867 1867
1868 function Test_splitkeep_fold() 1868 func Test_splitkeep_fold()
1869 CheckScreendump 1869 CheckScreendump
1870 1870
1871 let lines =<< trim END 1871 let lines =<< trim END
1872 set splitkeep=screen 1872 set splitkeep=screen
1873 set foldmethod=marker 1873 set foldmethod=marker
1893 1893
1894 call term_sendkeys(buf, ":wincmd k\<CR>:quit\<CR>") 1894 call term_sendkeys(buf, ":wincmd k\<CR>:quit\<CR>")
1895 call VerifyScreenDump(buf, 'Test_splitkeep_fold_4', {}) 1895 call VerifyScreenDump(buf, 'Test_splitkeep_fold_4', {})
1896 1896
1897 call StopVimInTerminal(buf) 1897 call StopVimInTerminal(buf)
1898 endfunction 1898 endfunc
1899 1899
1900 function Test_splitkeep_status() 1900 func Test_splitkeep_status()
1901 CheckScreendump 1901 CheckScreendump
1902 1902
1903 let lines =<< trim END 1903 let lines =<< trim END
1904 call setline(1, ['a', 'b', 'c']) 1904 call setline(1, ['a', 'b', 'c'])
1905 set nomodified 1905 set nomodified
1913 1913
1914 call term_sendkeys(buf, ":call win_move_statusline(win, 1)\<CR>") 1914 call term_sendkeys(buf, ":call win_move_statusline(win, 1)\<CR>")
1915 call VerifyScreenDump(buf, 'Test_splitkeep_status_1', {}) 1915 call VerifyScreenDump(buf, 'Test_splitkeep_status_1', {})
1916 1916
1917 call StopVimInTerminal(buf) 1917 call StopVimInTerminal(buf)
1918 endfunction 1918 endfunc
1919 1919
1920 function Test_new_help_window_on_error() 1920 func Test_new_help_window_on_error()
1921 help change.txt 1921 help change.txt
1922 execute "normal! /CTRL-@\<CR>" 1922 execute "normal! /CTRL-@\<CR>"
1923 silent! execute "normal! \<C-W>]" 1923 silent! execute "normal! \<C-W>]"
1924 1924
1925 let wincount = winnr('$') 1925 let wincount = winnr('$')
1926 help 'mod' 1926 help 'mod'
1927 1927
1928 call assert_equal(wincount, winnr('$')) 1928 call assert_equal(wincount, winnr('$'))
1929 call assert_equal(expand("<cword>"), "'mod'") 1929 call assert_equal(expand("<cword>"), "'mod'")
1930 endfunction 1930 endfunc
1931
1932 func Test_smoothscroll_in_zero_width_window()
1933 let save_lines = &lines
1934 let save_columns = &columns
1935
1936 winsize 0 24
1937 set cpo+=n
1938 exe "noremap 0 \<C-W>n\<C-W>L"
1939 norm 000000
1940 set number smoothscroll
1941 exe "norm \<C-Y>"
1942
1943 only!
1944 let &lines = save_lines
1945 let &columns = save_columns
1946 set cpo-=n
1947 unmap 0
1948 set nonumber nosmoothscroll
1949 endfunc
1931 1950
1932 1951
1933 " vim: shiftwidth=2 sts=2 expandtab 1952 " vim: shiftwidth=2 sts=2 expandtab