comparison src/testdir/test_textprop.vim @ 15292:ba6f0f1bb9d0 v8.1.0654

patch 8.1.0654: when deleting a line text property flags are not adjusted commit https://github.com/vim/vim/commit/c1a9bc1a7284bd0e60f9bddfef6a4ee733bfc838 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 28 21:59:29 2018 +0100 patch 8.1.0654: when deleting a line text property flags are not adjusted Problem: When deleting a line text property flags are not adjusted. Solution: Adjust text property flags in preceding and following lines.
author Bram Moolenaar <Bram@vim.org>
date Fri, 28 Dec 2018 22:00:05 +0100
parents 27783a6f430b
children 2d8225cc1315
comparison
equal deleted inserted replaced
15291:11c4950be418 15292:ba6f0f1bb9d0
195 wincmd w 195 wincmd w
196 call DeletePropTypes() 196 call DeletePropTypes()
197 bwipe! 197 bwipe!
198 endfunc 198 endfunc
199 199
200 " Setup a three line prop in lines 2 - 4.
201 " Add short props in line 1 and 5.
202 func Setup_three_line_prop()
203 new
204 call setline(1, ['one', 'twotwo', 'three', 'fourfour', 'five'])
205 call prop_add(1, 2, {'length': 1, 'type': 'comment'})
206 call prop_add(2, 4, {'end_lnum': 4, 'end_col': 5, 'type': 'comment'})
207 call prop_add(5, 2, {'length': 1, 'type': 'comment'})
208 endfunc
209
200 func Test_prop_multiline() 210 func Test_prop_multiline()
201 call prop_type_add('comment', {'highlight': 'Directory'}) 211 call prop_type_add('comment', {'highlight': 'Directory'})
202 new 212 new
203 call setline(1, ['xxxxxxx', 'yyyyyyyyy', 'zzzzzzzz']) 213 call setline(1, ['xxxxxxx', 'yyyyyyyyy', 'zzzzzzzz'])
204 214
221 let expect3.length = 9 231 let expect3.length = 9
222 call assert_equal([expect3], prop_list(3)) 232 call assert_equal([expect3], prop_list(3))
223 call prop_clear(1, 3) 233 call prop_clear(1, 3)
224 234
225 bwipe! 235 bwipe!
236
237 " Test deleting the first line with a prop.
238 call Setup_three_line_prop()
239 let expect2 = {'col': 4, 'length': 4, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0}
240 call assert_equal([expect2], prop_list(2))
241 2del
242 let expect_short = {'col': 2, 'length': 1, 'type': 'comment', 'start': 1, 'end': 1, 'id': 0}
243 call assert_equal([expect_short], prop_list(1))
244 let expect2 = {'col': 1, 'length': 6, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0}
245 call assert_equal([expect2], prop_list(2))
246 bwipe!
247
248 " Test deleting the last line with a prop.
249 call Setup_three_line_prop()
250 let expect3 = {'col': 1, 'length': 6, 'type': 'comment', 'start': 0, 'end': 0, 'id': 0}
251 call assert_equal([expect3], prop_list(3))
252 let expect4 = {'col': 1, 'length': 5, 'type': 'comment', 'start': 0, 'end': 1, 'id': 0}
253 call assert_equal([expect4], prop_list(4))
254 4del
255 let expect3 = {'col': 1, 'length': 6, 'type': 'comment', 'start': 0, 'end': 1, 'id': 0}
256 call assert_equal([expect3], prop_list(3))
257 call assert_equal([expect_short], prop_list(4))
258 bwipe!
259
226 call prop_type_delete('comment') 260 call prop_type_delete('comment')
227 endfunc 261 endfunc
228 262
229 func Test_prop_byteoff() 263 func Test_prop_byteoff()
230 call prop_type_add('comment', {'highlight': 'Directory'}) 264 call prop_type_add('comment', {'highlight': 'Directory'})