diff src/testdir/test_textprop.vim @ 15398:3e02464faaac v8.1.0707

patch 8.1.0707: text property columns are not adjusted for changed indent commit https://github.com/vim/vim/commit/663bc89bbb8158bd0888f7d7228b2dbc6bbd4802 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 8 23:07:24 2019 +0100 patch 8.1.0707: text property columns are not adjusted for changed indent Problem: Text property columns are not adjusted for changed indent. Solution: Adjust text properties.
author Bram Moolenaar <Bram@vim.org>
date Tue, 08 Jan 2019 23:15:05 +0100
parents 273649cad196
children 857ce36c8412
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -342,6 +342,40 @@ func Test_prop_substitute()
   bwipe!
 endfunc
 
+func Test_prop_change_indent()
+  call prop_type_add('comment', {'highlight': 'Directory'})
+  new
+  call setline(1, ['    xxx', 'yyyyy'])
+  call prop_add(2, 2, {'length': 2, 'type': 'comment'})
+  let expect = {'col': 2, 'length': 2, 'type': 'comment', 'start': 1, 'end': 1, 'id': 0}
+  call assert_equal([expect], prop_list(2))
+
+  set shiftwidth=3
+  normal 2G>>
+  call assert_equal('   yyyyy', getline(2))
+  let expect.col += 3
+  call assert_equal([expect], prop_list(2))
+
+  normal 2G==
+  call assert_equal('    yyyyy', getline(2))
+  let expect.col = 6
+  call assert_equal([expect], prop_list(2))
+
+  call prop_clear(2)
+  call prop_add(2, 2, {'length': 5, 'type': 'comment'})
+  let expect.col = 2
+  let expect.length = 5
+  call assert_equal([expect], prop_list(2))
+
+  normal 2G<<
+  call assert_equal(' yyyyy', getline(2))
+  let expect.length = 2
+  call assert_equal([expect], prop_list(2))
+
+  set shiftwidth&
+  call prop_type_delete('comment')
+endfunc
+
 " Setup a three line prop in lines 2 - 4.
 " Add short props in line 1 and 5.
 func Setup_three_line_prop()