comparison src/testdir/test_textprop.vim @ 18444:967ca19425e3 v8.1.2216

patch 8.1.2216: text property in wrong place after :substitute Commit: https://github.com/vim/vim/commit/1fd30d7bae1b3e57f008c052d765a3ec73d58114 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Oct 25 22:13:29 2019 +0200 patch 8.1.2216: text property in wrong place after :substitute Problem: Text property in wrong place after :substitute. Solution: Pass the new column instead of the old one. (Christian Brabandt, closes #4427)
author Bram Moolenaar <Bram@vim.org>
date Fri, 25 Oct 2019 22:15:03 +0200
parents d2228d4cf1f6
children 0ac88fdbf089
comparison
equal deleted inserted replaced
18443:21f48049529e 18444:967ca19425e3
864 bwipe! Xaaa 864 bwipe! Xaaa
865 bwipe! Xbbb 865 bwipe! Xbbb
866 cal delete('Xaaa') 866 cal delete('Xaaa')
867 cal delete('Xbbb') 867 cal delete('Xbbb')
868 endfunc 868 endfunc
869
870 func Test_proptype_substitute2()
871 new
872 " text_prop.vim
873 call setline(1, [
874 \ 'The num 123 is smaller than 4567.',
875 \ '123 The number 123 is smaller than 4567.',
876 \ '123 The number 123 is smaller than 4567.'])
877
878 call prop_type_add('number', {'highlight': 'ErrorMsg'})
879
880 call prop_add(1, 12, {'length': 3, 'type': 'number'})
881 call prop_add(2, 1, {'length': 3, 'type': 'number'})
882 call prop_add(3, 36, {'length': 4, 'type': 'number'})
883 set ul&
884 let expected = [{'id': 0, 'col': 13, 'end': 1, 'type': 'number', 'length': 3, 'start': 1},
885 \ {'id': 0, 'col': 1, 'end': 1, 'type': 'number', 'length': 3, 'start': 1},
886 \ {'id': 0, 'col': 50, 'end': 1, 'type': 'number', 'length': 4, 'start': 1}]
887 " Add some text in between
888 %s/\s\+/ /g
889 call assert_equal(expected, prop_list(1) + prop_list(2) + prop_list(3))
890
891 " remove some text
892 :1s/[a-z]\{3\}//g
893 let expected = [{'id': 0, 'col': 10, 'end': 1, 'type': 'number', 'length': 3, 'start': 1}]
894 call assert_equal(expected, prop_list(1))
895 bwipe!
896 endfunc