To: vim_dev@googlegroups.com Subject: Patch 8.2.0083 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0083 Problem: Text properties wrong when tabs and spaces are exchanged. Solution: Take text properties into account. (Nobuhiro Takasaki, closes #5427) Files: src/edit.c, src/testdir/test_textprop.vim *** ../vim-8.2.0082/src/edit.c 2019-12-01 21:04:37.000000000 +0100 --- src/edit.c 2020-01-03 21:07:52.869496793 +0100 *************** *** 5601,5614 **** i = cursor->col - fpos.col; if (i > 0) { ! STRMOVE(ptr, ptr + i); // correct replace stack. if ((State & REPLACE_FLAG) && !(State & VREPLACE_FLAG)) for (temp = i; --temp >= 0; ) replace_join(repl_off); - #ifdef FEAT_PROP_POPUP - curbuf->b_ml.ml_line_len -= i; - #endif } #ifdef FEAT_NETBEANS_INTG if (netbeans_active()) --- 5601,5620 ---- i = cursor->col - fpos.col; if (i > 0) { ! #ifdef FEAT_PROP_POPUP ! if (!(State & VREPLACE_FLAG)) ! { ! mch_memmove(ptr, ptr + i, curbuf->b_ml.ml_line_len - i ! - (ptr - curbuf->b_ml.ml_line_ptr)); ! curbuf->b_ml.ml_line_len -= i; ! } ! else ! #endif ! STRMOVE(ptr, ptr + i); // correct replace stack. if ((State & REPLACE_FLAG) && !(State & VREPLACE_FLAG)) for (temp = i; --temp >= 0; ) replace_join(repl_off); } #ifdef FEAT_NETBEANS_INTG if (netbeans_active()) *** ../vim-8.2.0082/src/testdir/test_textprop.vim 2019-11-16 20:40:00.000000000 +0100 --- src/testdir/test_textprop.vim 2020-01-03 21:01:54.878743475 +0100 *************** *** 925,927 **** --- 925,963 ---- call assert_equal(expected, prop_list(1)) bwipe! endfunc + + func Test_textprop_noexpandtab() + %bwipe! + new + let save_ts = &tabstop + set tabstop=8 + let save_sts = &softtabstop + set softtabstop=4 + let save_sw = &shiftwidth + set shiftwidth=4 + let save_et = &expandtab + set noexpandtab + let save_fdm = &foldmethod + set foldmethod=marker + call feedkeys("\\0Ca\\\", "tx") + call prop_type_add('test', {'highlight': 'ErrorMsg'}) + call prop_add(1, 1, {'end_col': 2, 'type': 'test'}) + call feedkeys("0i\", "tx") + call prop_remove({'type': 'test'}) + call prop_add(1, 2, {'end_col': 3, 'type': 'test'}) + call feedkeys("A\\", "tx") + call prop_remove({'type': 'test'}) + try + " It is correct that this does not pass + call prop_add(1, 6, {'end_col': 7, 'type': 'test'}) + " Has already collapsed here, start_col:6 does not result in an error + call feedkeys("A\\", "tx") + catch /^Vim\%((\a\+)\)\=:E964/ + endtry + call prop_remove({'type': 'test'}) + let &foldmethod = save_fdm + let &expandtab = save_et + let &shiftwidth = save_sw + let &softtabstop = save_sts + let &tabstop = save_ts + endfunc *** ../vim-8.2.0082/src/version.c 2020-01-03 20:59:55.847158293 +0100 --- src/version.c 2020-01-03 21:24:58.174165767 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 83, /**/ -- BROTHER MAYNARD: Armaments Chapter Two Verses Nine to Twenty One. ANOTHER MONK: And St. Attila raised his hand grenade up on high saying "O Lord bless this thy hand grenade that with it thou mayest blow thine enemies to tiny bits, in thy mercy. "and the Lord did grin and people did feast upon the lambs and sloths and carp and anchovies and orang-utans and breakfast cereals and fruit bats and... BROTHER MAYNARD: Skip a bit brother ... "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///