comparison src/testdir/test_normal.vim @ 26061:787c8061c747 v8.2.3564

patch 8.2.3564: invalid memory access when scrolling without valid screen Commit: https://github.com/vim/vim/commit/777e7c21b7627be80961848ac560cb0a9978ff43 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Oct 25 17:07:04 2021 +0100 patch 8.2.3564: invalid memory access when scrolling without valid screen Problem: Invalid memory access when scrolling without a valid screen. Solution: Do not set VALID_BOTLINE in w_valid.
author Bram Moolenaar <Bram@vim.org>
date Mon, 25 Oct 2021 18:15:03 +0200
parents acda780ffc3e
children f53f365078dd
comparison
equal deleted inserted replaced
26060:b392baba0478 26061:787c8061c747
32 elseif a:type == 'line' 32 elseif a:type == 'line'
33 silent exe "normal! '[V']y" 33 silent exe "normal! '[V']y"
34 else 34 else
35 silent exe "normal! `[v`]y" 35 silent exe "normal! `[v`]y"
36 endif 36 endif
37 let g:a=strlen(substitute(@@, '[^ ]', '', 'g')) 37 let g:a = strlen(substitute(@@, '[^ ]', '', 'g'))
38 let &selection = sel_save 38 let &selection = sel_save
39 let @@ = reg_save 39 let @@ = reg_save
40 endfunc 40 endfunc
41 41
42 func OpfuncDummy(type, ...) 42 func OpfuncDummy(type, ...)
43 " for testing operatorfunc 43 " for testing operatorfunc
44 let g:opt=&linebreak 44 let g:opt = &linebreak
45 45
46 if a:0 " Invoked from Visual mode, use gv command. 46 if a:0 " Invoked from Visual mode, use gv command.
47 silent exe "normal! gvy" 47 silent exe "normal! gvy"
48 elseif a:type == 'line' 48 elseif a:type == 'line'
49 silent exe "normal! '[V']y" 49 silent exe "normal! '[V']y"
50 else 50 else
51 silent exe "normal! `[v`]y" 51 silent exe "normal! `[v`]y"
52 endif 52 endif
53 " Create a new dummy window 53 " Create a new dummy window
54 new 54 new
55 let g:bufnr=bufnr('%') 55 let g:bufnr = bufnr('%')
56 endfunc 56 endfunc
57 57
58 func Test_normal00_optrans() 58 func Test_normal00_optrans()
59 new 59 new
60 call append(0, ['1 This is a simple test: abcd', '2 This is the second line', '3 this is the third line']) 60 call append(0, ['1 This is a simple test: abcd', '2 This is the second line', '3 this is the third line'])
983 call assert_equal(1, line('w0')) 983 call assert_equal(1, line('w0'))
984 call assert_equal(15, line('w$')) 984 call assert_equal(15, line('w$'))
985 985
986 set foldenable& 986 set foldenable&
987 close! 987 close!
988 endfunc
989
990 func Test_scroll_in_ex_mode()
991 " This was using invalid memory because w_botline was invalid.
992 let lines =<< trim END
993 diffsplit
994 norm os00(
995 call writefile(['done'], 'Xdone')
996 qa!
997 END
998 call writefile(lines, 'Xscript')
999 call assert_equal(1, RunVim([], [], '--clean -X -Z -e -s -S Xscript'))
1000 call assert_equal(['done'], readfile('Xdone'))
1001
1002 call delete('Xscript')
1003 call delete('Xdone')
988 endfunc 1004 endfunc
989 1005
990 " Test for the 'sidescroll' option 1006 " Test for the 'sidescroll' option
991 func Test_sidescroll_opt() 1007 func Test_sidescroll_opt()
992 new 1008 new