comparison src/testdir/test_textprop.vim @ 29748:7e2321707fea v9.0.0214

patch 9.0.0214: splitting a line may duplicate virtual text Commit: https://github.com/vim/vim/commit/d8d4cfcb393123fa19640be0806091d47935407f Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 15 15:55:10 2022 +0100 patch 9.0.0214: splitting a line may duplicate virtual text Problem: Splitting a line may duplicate virtual text. (Ben Jackson) Solution: Don't duplicate a text property with virtual text. Make auto-indenting work better. (closes #10919)
author Bram Moolenaar <Bram@vim.org>
date Mon, 15 Aug 2022 17:00:06 +0200
parents b167c91b5f6b
children d08aa1bfe319
comparison
equal deleted inserted replaced
29747:5a91d76d1813 29748:7e2321707fea
2941 func Test_insert_text_start_incl() 2941 func Test_insert_text_start_incl()
2942 CheckRunVimInTerminal 2942 CheckRunVimInTerminal
2943 2943
2944 let lines =<< trim END 2944 let lines =<< trim END
2945 vim9script 2945 vim9script
2946 setline(1, 'text one text two') 2946 setline(1, ['text one text two', '', 'function(arg)'])
2947 2947
2948 prop_type_add('propincl', {highlight: 'NonText', start_incl: true}) 2948 prop_type_add('propincl', {highlight: 'NonText', start_incl: true})
2949 prop_add(1, 6, {type: 'propincl', text: 'after '}) 2949 prop_add(1, 6, {type: 'propincl', text: 'after '})
2950 cursor(1, 6) 2950 cursor(1, 6)
2951 prop_type_add('propnotincl', {highlight: 'NonText', start_incl: false}) 2951 prop_type_add('propnotincl', {highlight: 'NonText', start_incl: false})
2952 prop_add(1, 15, {type: 'propnotincl', text: 'before '}) 2952 prop_add(1, 15, {type: 'propnotincl', text: 'before '})
2953
2954 set cindent sw=4
2955 prop_type_add('argname', {highlight: 'DiffChange', start_incl: true})
2956 prop_add(3, 10, {type: 'argname', text: 'arg: '})
2953 END 2957 END
2954 call writefile(lines, 'XscriptPropsStartIncl') 2958 call writefile(lines, 'XscriptPropsStartIncl')
2955 let buf = RunVimInTerminal('-S XscriptPropsStartIncl', #{rows: 8, cols: 60}) 2959 let buf = RunVimInTerminal('-S XscriptPropsStartIncl', #{rows: 8, cols: 60})
2956 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_1', {}) 2960 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_1', {})
2957 2961
2962 2966
2963 call term_sendkeys(buf, "2wi") 2967 call term_sendkeys(buf, "2wi")
2964 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_4', {}) 2968 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_4', {})
2965 call term_sendkeys(buf, "yy\<Esc>") 2969 call term_sendkeys(buf, "yy\<Esc>")
2966 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_5', {}) 2970 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_5', {})
2971
2972 call term_sendkeys(buf, "3Gfai\<CR>\<Esc>")
2973 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_6', {})
2974 call term_sendkeys(buf, ">>")
2975 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_7', {})
2976 call term_sendkeys(buf, "<<<<")
2977 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_8', {})
2967 2978
2968 call StopVimInTerminal(buf) 2979 call StopVimInTerminal(buf)
2969 call delete('XscriptPropsStartIncl') 2980 call delete('XscriptPropsStartIncl')
2970 endfunc 2981 endfunc
2971 2982