comparison src/testdir/test_textprop.vim @ 31319:243c35fad9cb v9.0.0993

patch 9.0.0993: display errors when adding or removing text property type Commit: https://github.com/vim/vim/commit/89469d157aea01513bde826b4519dd6b5fbceae4 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 2 20:46:26 2022 +0000 patch 9.0.0993: display errors when adding or removing text property type Problem: Display errors when adding or removing text property type. Solution: Perform a full redraw. Only use text properties for which the type is defined. (closes #11655)
author Bram Moolenaar <Bram@vim.org>
date Fri, 02 Dec 2022 22:00:04 +0100
parents d7a532c4d18d
children a93392e93a53
comparison
equal deleted inserted replaced
31318:23d42fb4e938 31319:243c35fad9cb
1698 call assert_fails('call prop_type_add([], {})', 'E730:') 1698 call assert_fails('call prop_type_add([], {})', 'E730:')
1699 call assert_fails("call prop_type_change('long', {'xyz' : 10})", 'E971:') 1699 call assert_fails("call prop_type_change('long', {'xyz' : 10})", 'E971:')
1700 call assert_fails("call prop_type_delete([])", 'E730:') 1700 call assert_fails("call prop_type_delete([])", 'E730:')
1701 call assert_fails("call prop_type_delete('xyz', [])", 'E715:') 1701 call assert_fails("call prop_type_delete('xyz', [])", 'E715:')
1702 call assert_fails("call prop_type_get([])", 'E730:') 1702 call assert_fails("call prop_type_get([])", 'E730:')
1703 call assert_fails("call prop_type_get('', [])", 'E474:') 1703 call assert_fails("call prop_type_get('', [])", 'E475:')
1704 call assert_fails("call prop_type_list([])", 'E715:') 1704 call assert_fails("call prop_type_list([])", 'E715:')
1705 call assert_fails("call prop_type_add('yyy', 'not_a_dict')", 'E715:') 1705 call assert_fails("call prop_type_add('yyy', 'not_a_dict')", 'E715:')
1706 call assert_fails("call prop_add(1, 5, {'type':'missing_type', 'length':1})", 'E971:') 1706 call assert_fails("call prop_add(1, 5, {'type':'missing_type', 'length':1})", 'E971:')
1707 call assert_fails("call prop_add(1, 5, {'type': ''})", 'E971:') 1707 call assert_fails("call prop_add(1, 5, {'type': ''})", 'E971:')
1708 call assert_fails('call prop_add(1, 1, 0)', 'E1206:') 1708 call assert_fails('call prop_add(1, 1, 0)', 'E1206:')
3625 prop_type_delete(prop_type) 3625 prop_type_delete(prop_type)
3626 cclose 3626 cclose
3627 bwipe! 3627 bwipe!
3628 enddef 3628 enddef
3629 3629
3630 func Test_text_prop_delete_updates()
3631 CheckRunVimInTerminal
3632
3633 let lines =<< trim END
3634 vim9script
3635
3636 setline(1, ['some text', 'more text', 'the end'])
3637 prop_type_add('test', {highlight: 'DiffChange'})
3638 prop_add(1, 0, {
3639 type: 'test',
3640 text: 'The quick brown fox jumps over the lazy dog',
3641 text_align: 'below',
3642 text_padding_left: 3,
3643 })
3644 prop_add(1, 0, {
3645 type: 'test',
3646 text: 'The quick brown fox jumps over the lazy dog',
3647 text_align: 'below',
3648 text_padding_left: 5,
3649 })
3650
3651 normal! G
3652 END
3653 call writefile(lines, 'XtextPropDelete', 'D')
3654 let buf = RunVimInTerminal('-S XtextPropDelete', #{rows: 10, cols: 60})
3655 call VerifyScreenDump(buf, 'Test_prop_delete_updates_1', {})
3656
3657 " Check that after deleting the text prop type the text properties using
3658 " this type no longer show and are not counted for cursor positioning.
3659 call term_sendkeys(buf, ":call prop_type_delete('test')\<CR>")
3660 call VerifyScreenDump(buf, 'Test_prop_delete_updates_2', {})
3661
3662 call term_sendkeys(buf, "ggj")
3663 call VerifyScreenDump(buf, 'Test_prop_delete_updates_3', {})
3664
3665 call StopVimInTerminal(buf)
3666 endfunc
3667
3630 3668
3631 " vim: shiftwidth=2 sts=2 expandtab 3669 " vim: shiftwidth=2 sts=2 expandtab