comparison src/testdir/test_textprop.vim @ 29708:d97b2ce26258 v9.0.0194

patch 9.0.0194: cursor displayed in wrong position after removing text prop Commit: https://github.com/vim/vim/commit/326c5d36e7cb8526330565109c17b4a13ff790ae Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 12 13:05:49 2022 +0100 patch 9.0.0194: cursor displayed in wrong position after removing text prop Problem: Cursor displayed in wrong position after removing text prop. (Ben Jackson) Solution: Invalidate the cursor position. (closes #10898)
author Bram Moolenaar <Bram@vim.org>
date Fri, 12 Aug 2022 14:15:04 +0200
parents a680dc1b089d
children 538204fce2a4
comparison
equal deleted inserted replaced
29707:325f7101453d 29708:d97b2ce26258
2773 2773
2774 call StopVimInTerminal(buf) 2774 call StopVimInTerminal(buf)
2775 call delete('XscriptPropsBelowNowrap') 2775 call delete('XscriptPropsBelowNowrap')
2776 endfunc 2776 endfunc
2777 2777
2778 func Test_props_with_text_CursorMoved()
2779 CheckRunVimInTerminal
2780
2781 let lines =<< trim END
2782 call setline(1, ['this is line one', 'this is line two', 'three', 'four', 'five'])
2783
2784 call prop_type_add('prop', #{highlight: 'Error'})
2785 let g:long_text = repeat('x', &columns * 2)
2786
2787 let g:prop_id = v:null
2788 func! Update()
2789 if line('.') == 1
2790 if g:prop_id == v:null
2791 let g:prop_id = prop_add(1, 0, #{type: 'prop', text_wrap: 'wrap', text: g:long_text})
2792 endif
2793 elseif g:prop_id != v:null
2794 call prop_remove(#{id: g:prop_id})
2795 let g:prop_id = v:null
2796 endif
2797 endfunc
2798
2799 autocmd CursorMoved * call Update()
2800 END
2801 call writefile(lines, 'XscriptPropsCursorMovec')
2802 let buf = RunVimInTerminal('-S XscriptPropsCursorMovec', #{rows: 8, cols: 60})
2803 call term_sendkeys(buf, "gg0w")
2804 call VerifyScreenDump(buf, 'Test_prop_with_text_cursormoved_1', {})
2805
2806 call term_sendkeys(buf, "j")
2807 call VerifyScreenDump(buf, 'Test_prop_with_text_cursormoved_2', {})
2808
2809 " back to the first state
2810 call term_sendkeys(buf, "k")
2811 call VerifyScreenDump(buf, 'Test_prop_with_text_cursormoved_1', {})
2812
2813 call StopVimInTerminal(buf)
2814 call delete('XscriptPropsCursorMovec')
2815 endfunc
2816
2778 func Test_props_with_text_after_split_join() 2817 func Test_props_with_text_after_split_join()
2779 CheckRunVimInTerminal 2818 CheckRunVimInTerminal
2780 2819
2781 let lines =<< trim END 2820 let lines =<< trim END
2782 call setline(1, ['1122']) 2821 call setline(1, ['1122'])