comparison src/testdir/test_textprop.vim @ 16682:7847d281cbbf v8.1.1343

patch 8.1.1343: text properties not adjusted for Visual block mode delete commit https://github.com/vim/vim/commit/8055d17388736421d875dd4933c4c93d49a2ab58 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 17 22:57:26 2019 +0200 patch 8.1.1343: text properties not adjusted for Visual block mode delete Problem: Text properties not adjusted for Visual block mode delete. Solution: Call adjust_prop_columns(). (closes https://github.com/vim/vim/issues/4384)
author Bram Moolenaar <Bram@vim.org>
date Fri, 17 May 2019 23:00:05 +0200
parents 6f453673eb19
children 23af483c4ceb
comparison
equal deleted inserted replaced
16681:12218ecea336 16682:7847d281cbbf
611 bwipe! 611 bwipe!
612 call prop_type_delete('comment') 612 call prop_type_delete('comment')
613 endfunc 613 endfunc
614 614
615 " screenshot test with textprop highlighting 615 " screenshot test with textprop highlighting
616 funct Test_textprop_screenshots() 616 func Test_textprop_screenshot_various()
617 " The Vim running in the terminal needs to use utf-8. 617 " The Vim running in the terminal needs to use utf-8.
618 if !CanRunVimInTerminal() || g:orig_encoding != 'utf-8' 618 if !CanRunVimInTerminal() || g:orig_encoding != 'utf-8'
619 return 619 return
620 endif 620 endif
621 call writefile([ 621 call writefile([
669 669
670 " clean up 670 " clean up
671 call StopVimInTerminal(buf) 671 call StopVimInTerminal(buf)
672 call delete('XtestProp') 672 call delete('XtestProp')
673 endfunc 673 endfunc
674
675 func RunTestVisualBlock(width, dump)
676 call writefile([
677 \ "call setline(1, ["
678 \ .. "'xxxxxxxxx 123 x',"
679 \ .. "'xxxxxxxx 123 x',"
680 \ .. "'xxxxxxx 123 x',"
681 \ .. "'xxxxxx 123 x',"
682 \ .. "'xxxxx 123 x',"
683 \ .. "'xxxx 123 xx',"
684 \ .. "'xxx 123 xxx',"
685 \ .. "'xx 123 xxxx',"
686 \ .. "'x 123 xxxxx',"
687 \ .. "' 123 xxxxxx',"
688 \ .. "])",
689 \ "hi SearchProp ctermbg=yellow",
690 \ "call prop_type_add('search', {'highlight': 'SearchProp'})",
691 \ "call prop_add(1, 11, {'length': 3, 'type': 'search'})",
692 \ "call prop_add(2, 10, {'length': 3, 'type': 'search'})",
693 \ "call prop_add(3, 9, {'length': 3, 'type': 'search'})",
694 \ "call prop_add(4, 8, {'length': 3, 'type': 'search'})",
695 \ "call prop_add(5, 7, {'length': 3, 'type': 'search'})",
696 \ "call prop_add(6, 6, {'length': 3, 'type': 'search'})",
697 \ "call prop_add(7, 5, {'length': 3, 'type': 'search'})",
698 \ "call prop_add(8, 4, {'length': 3, 'type': 'search'})",
699 \ "call prop_add(9, 3, {'length': 3, 'type': 'search'})",
700 \ "call prop_add(10, 2, {'length': 3, 'type': 'search'})",
701 \ "normal 1G6|\<C-V>" .. repeat('l', a:width - 1) .. "10jx",
702 \], 'XtestPropVis')
703 let buf = RunVimInTerminal('-S XtestPropVis', {'rows': 12})
704 call VerifyScreenDump(buf, 'Test_textprop_vis_' .. a:dump, {})
705
706 " clean up
707 call StopVimInTerminal(buf)
708 call delete('XtestPropVis')
709 endfunc
710
711 " screenshot test with Visual block mode operations
712 func Test_textprop_screenshot_visual()
713 if !CanRunVimInTerminal()
714 return
715 endif
716
717 " Delete two columns while text props are three chars wide.
718 call RunTestVisualBlock(2, '01')
719
720 " Same, but delete four columns
721 call RunTestVisualBlock(4, '02')
722 endfunc