comparison src/testdir/test_textprop.vim @ 19631:1d493fce1fbd v8.2.0372

patch 8.2.0372: prop_find() may not find text property at start of the line Commit: https://github.com/vim/vim/commit/66b98854d86f641db036fd1e6cf20f7b8905344e Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 11 19:15:52 2020 +0100 patch 8.2.0372: prop_find() may not find text property at start of the line Problem: Prop_find() may not find text property at start of the line. Solution: Adjust the loop to find properties. (Axel Forsman, closes https://github.com/vim/vim/issues/5761, closes #5663)
author Bram Moolenaar <Bram@vim.org>
date Wed, 11 Mar 2020 21:31:02 +0100
parents 67f39cb0a49c
children 647ef636a11e
comparison
equal deleted inserted replaced
19630:522158d28042 19631:1d493fce1fbd
1164 1164
1165 bwipe! 1165 bwipe!
1166 call prop_remove({'type': 'test'}) 1166 call prop_remove({'type': 'test'})
1167 call prop_type_delete('test') 1167 call prop_type_delete('test')
1168 endfunc 1168 endfunc
1169
1170 func Test_find_prop_later_in_line()
1171 new
1172 call prop_type_add('test', {'highlight': 'ErrorMsg'})
1173 call setline(1, 'just some text')
1174 call prop_add(1, 1, {'length': 4, 'type': 'test'})
1175 call prop_add(1, 10, {'length': 3, 'type': 'test'})
1176
1177 call assert_equal({'id': 0, 'lnum': 1, 'col': 10, 'end': 1, 'type': 'test', 'length': 3, 'start': 1},
1178 \ prop_find(#{type: 'test', lnum: 1, col: 6}))
1179
1180 bwipe!
1181 call prop_type_delete('test')
1182 endfunc
1183
1184 func Test_find_zerowidth_prop_sol()
1185 new
1186 call prop_type_add('test', {'highlight': 'ErrorMsg'})
1187 call setline(1, 'just some text')
1188 call prop_add(1, 1, {'length': 0, 'type': 'test'})
1189
1190 call assert_equal({'id': 0, 'lnum': 1, 'col': 1, 'end': 1, 'type': 'test', 'length': 0, 'start': 1},
1191 \ prop_find(#{type: 'test', lnum: 1}))
1192
1193 bwipe!
1194 call prop_type_delete('test')
1195 endfunc