Mercurial > vim
diff src/testdir/test_textprop.vim @ 15349:6abee072b93c v8.1.0682
patch 8.1.0682: text properties not adjusted when backspacing replaced text
commit https://github.com/vim/vim/commit/196d157f12cf0476d97f78834155fc67d6b161de
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 2 23:47:18 2019 +0100
patch 8.1.0682: text properties not adjusted when backspacing replaced text
Problem: Text properties are not adjusted when backspacing replaced text.
Solution: Keep text properties on text restored in replace mode.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 03 Jan 2019 00:00:54 +0100 |
parents | f6b522596993 |
children | 45f36b66a032 |
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -145,6 +145,19 @@ func Test_prop_remove() bwipe! endfunc +func SetupOneLine() + call setline(1, 'xonex xtwoxx') + call AddPropTypes() + call prop_add(1, 2, {'length': 3, 'id': 11, 'type': 'one'}) + call prop_add(1, 8, {'length': 3, 'id': 12, 'type': 'two'}) + let expected = [ + \ {'col': 2, 'length': 3, 'id': 11, 'type': 'one', 'start': 1, 'end': 1}, + \ {'col': 8, 'length': 3, 'id': 12, 'type': 'two', 'start': 1, 'end': 1}, + \] + call assert_equal(expected, prop_list(1)) + return expected +endfunc + func Test_prop_add_remove_buf() new let bufnr = bufnr('') @@ -180,15 +193,7 @@ endfunc func Test_prop_backspace() new set bs=2 - call setline(1, 'xonex xtwoxx') - call AddPropTypes() - call prop_add(1, 2, {'length': 3, 'id': 11, 'type': 'one'}) - call prop_add(1, 8, {'length': 3, 'id': 12, 'type': 'two'}) - let expected = [ - \ {'col': 2, 'length': 3, 'id': 11, 'type': 'one', 'start': 1, 'end': 1}, - \ {'col': 8, 'length': 3, 'id': 12, 'type': 'two', 'start': 1, 'end': 1}, - \] - call assert_equal(expected, prop_list(1)) + let expected = SetupOneLine() " 'xonex xtwoxx' exe "normal 0li\<BS>\<Esc>fxli\<BS>\<Esc>" call assert_equal('one xtwoxx', getline(1)) @@ -201,6 +206,32 @@ func Test_prop_backspace() set bs& endfunc +func Test_prop_replace() + new + set bs=2 + let expected = SetupOneLine() " 'xonex xtwoxx' + + exe "normal 0Ryyy\<Esc>" + call assert_equal('yyyex xtwoxx', getline(1)) + call assert_equal(expected, prop_list(1)) + + exe "normal ftRyy\<BS>" + call assert_equal('yyyex xywoxx', getline(1)) + call assert_equal(expected, prop_list(1)) + + exe "normal 0fwRyy\<BS>" + call assert_equal('yyyex xyyoxx', getline(1)) + call assert_equal(expected, prop_list(1)) + + exe "normal 0foRyy\<BS>\<BS>" + call assert_equal('yyyex xyyoxx', getline(1)) + call assert_equal(expected, prop_list(1)) + + call DeletePropTypes() + bwipe! + set bs& +endfunc + func Test_prop_clear() new call AddPropTypes()